@import url('css/portals.css');
@import url('css/sidebar.css');
@import url('css/terminal.css');

/* ==========================================================================
   Antigravity Premium Chat Mirror Styles
   Theme: Deep Space Glassmorphism
   ========================================================================== */

:root {
    --bg-gradient-start: #0a0b16;
    --bg-gradient-end: #0f112a;
    --sidebar-bg: rgba(13, 14, 35, 0.4);
    --glass-bg: rgba(18, 20, 48, 0.45);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-glow: rgba(99, 102, 241, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    
    --user-bubble-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(99, 102, 241, 0.15) 100%);
    --bot-bubble-bg: rgba(22, 25, 59, 0.5);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Core Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    height: var(--vh, 100dvh);
    overflow: hidden !important;
    position: fixed !important;
    top: 0;
    left: 0;
    overscroll-behavior: none;
    background: radial-gradient(circle at 50% 50%, #16183d 0%, var(--bg-gradient-start) 70%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}



/* Main Chat Section */
.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: rgba(5, 6, 18, 0.2);
    min-width: 0; /* CRITICAL: Prevent Flexbox child width overflow clipping on mobile! */
    width: 100%;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    height: 70px;
    background: rgba(10, 11, 28, 0.95); /* Opacity boosted */
    /*     backdrop-filter: blur(12px); (Disabled to prevent mobile GPU crash) */
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 0 3.5rem;
    z-index: 5;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.settings-menu-container {
    position: relative;
    display: inline-block;
}

.settings-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.settings-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.settings-toggle-btn:active {
    transform: scale(0.95);
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: rgba(18, 20, 48, 0.95);
    /*     backdrop-filter: blur(20px) saturate(120%); (Disabled to prevent mobile GPU crash) */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2) inset;
    padding: 1.2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: settingsFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

@keyframes settingsFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.settings-dropdown.hidden {
    display: none !important;
}

.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0;
}

.settings-control-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-control-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.settings-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.6rem;
}

.settings-dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.option-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.option-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.2;
}


.chat-header h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    margin-right: 1rem;
}

/* Switch styling for Auto-scroll */
.switch-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.switch-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.icon-small {
    width: 16px;
    height: 16px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-purple);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Message Stream container */
.message-stream {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0%;
    height: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    padding: 2.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Hide for Firefox */
}

/* Custom Scrollbar - Disabled/Hidden */
.message-stream::-webkit-scrollbar {
    display: none; /* Hide for Chrome, Safari, and newer Opera */
}

.message-stream::-webkit-scrollbar-track {
    background: transparent;
}

.message-stream::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.message-stream::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Empty State */
.empty-state {
    margin: auto;
    max-width: 460px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
    opacity: 0.85;
}

.empty-icon-glow {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 20px 0 rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    margin-bottom: 0.5rem;
}

.large-icon {
    width: 32px;
    height: 32px;
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Conversation Message Container */
.message-row {
    display: flex;
    width: 100%;
    animation: messageFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.bot {
    justify-content: flex-start;
}

/* Avatar details */
.bot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-right: 0.75rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.avatar-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.avatar-icon {
    width: 18px;
    height: 18px;
    color: #fff;
}

/* Chat bubble styling */
.bubble {
    max-width: 82%;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem 1.75rem;
    position: relative;
    box-shadow: var(--shadow-premium);
    /*     backdrop-filter: blur(12px); (Disabled to prevent mobile GPU crash) */
}

.message-row.user .bubble {
    background: var(--user-bubble-bg);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-bottom-right-radius: 4px;
    color: #fff;
}

.message-row.bot .bubble {
    background: var(--bot-bubble-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top-left-radius: 4px;
}

/* Bubble Header & Footer Info */
.bubble-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.message-row.user .bubble-meta {
    background: #251e4d;
}

.message-row.bot .bubble-meta {
    background: #16193b;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bubble-meta .sender-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.message-row.user .bubble-meta .sender-name {
    color: var(--accent-purple);
}

.message-row.bot .bubble-meta .sender-name {
    color: var(--accent-cyan);
}

.bubble-meta .time {
    opacity: 0.8;
}

.meta-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.copy-msg-btn,
.speaker-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: var(--transition-smooth);
    padding: 0;
}

.copy-msg-btn:hover,
.speaker-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.copy-msg-btn.copied {
    color: var(--accent-emerald);
}

.speaker-btn.playing {
    color: var(--accent-cyan);
    animation: voiceWave 0.8s infinite alternate ease-in-out;
}

@keyframes voiceWave {
    0% {
        transform: scale(0.95);
        filter: drop-shadow(0 0 1px rgba(6, 182, 212, 0.3));
    }
    100% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.8));
    }
}

/* Markdown Rendering Custom Styles inside bubble */
.bubble-body {
    word-break: break-word;
    font-size: 0.95rem;
}

.bubble-body p {
    margin-bottom: 0.75rem;
}

.bubble-body p:last-child {
    margin-bottom: 0;
}

.bubble-body h1, .bubble-body h2, .bubble-body h3, .bubble-body h4 {
    font-family: var(--font-heading);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #fff;
    font-weight: 600;
}

.bubble-body h1 { font-size: 1.4rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 0.25rem; }
.bubble-body h2 { font-size: 1.25rem; }
.bubble-body h3 { font-size: 1.1rem; }

.bubble-body ul, .bubble-body ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.bubble-body li {
    margin-bottom: 0.25rem;
}

/* Tables inside Markdown */
.bubble-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.bubble-body th, .bubble-body td {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.bubble-body th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

.bubble-body td {
    background: rgba(0, 0, 0, 0.15);
}

/* Code block styles */
.bubble-body pre {
    background: #0d0e15 !important;
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.bubble-body code {
    font-family: monospace;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: var(--accent-pink);
}

.bubble-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: #e5e7eb;
}

/* Blockquotes */
.bubble-body blockquote {
    border-left: 3px solid var(--accent-purple);
    padding-left: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    border-radius: 0 4px 4px 0;
}

/* Alert Boxes style (GitHub format) */
.bubble-body blockquote.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    border-left-width: 4px;
    font-size: 0.9rem;
}

/* Copy code block helper */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.35rem 1rem;
    border-radius: 6px 6px 0 0;
    margin: -1rem -1rem 0.5rem -1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-smooth);
}

.copy-btn:hover {
    color: #fff;
}

/* Real-time Thinking typing indicator */
.thinking-container {
    display: flex;
    padding: 1rem 4rem;
    margin-top: -1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.thinking-container.hidden {
    display: none;
}

.thinking-bubble {
    background: rgba(30, 41, 59, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    border-top-left-radius: 4px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-premium);
}

.thinking-text {
    font-size: 0.85rem;
}

.wave {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 2px 4px;
}

.wave .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    animation: waveBounce 1.4s infinite ease-in-out;
}

.dot-red { background-color: #ef4444; }
.dot-orange { background-color: #f97316; }
.dot-yellow { background-color: #eab308; }
.dot-green { background-color: #22c55e; }
.dot-cyan { background-color: #06b6d4; }
.dot-blue { background-color: #3b82f6; }
.dot-purple { background-color: #a855f7; }

.wave .dot:nth-child(1) { animation-delay: 0s; }
.wave .dot:nth-child(2) { animation-delay: 0.15s; }
.wave .dot:nth-child(3) { animation-delay: 0.3s; }
.wave .dot:nth-child(4) { animation-delay: 0.45s; }
.wave .dot:nth-child(5) { animation-delay: 0.6s; }
.wave .dot:nth-child(6) { animation-delay: 0.75s; }
.wave .dot:nth-child(7) { animation-delay: 0.9s; }

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulseGlow {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    100% {
        transform: scale(1.3);
        opacity: 0.75;
    }
}

@keyframes ringRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes messageFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes waveBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* TTS Settings UI Styles */
.tts-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.setting-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rate-val {
    color: var(--accent-cyan);
    font-weight: 600;
}

.premium-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-family: var(--font-body);
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.premium-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.premium-select option {
    background: #0f112a;
    color: var(--text-primary);
}

.premium-range {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.premium-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    box-shadow: 0 0 4px rgba(6, 182, 212, 0.5);
    transition: var(--transition-smooth);
}

.premium-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Responsive adjust */
@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }
    
    .message-stream {
        padding: 1.5rem 1.5rem;
    }
    
    .thinking-container {
        padding: 0.5rem 1.5rem;
    }
    
    .bubble {
        max-width: 90%;
    }
}

/* Mobile Screen Tuning for Android Edge & other mobile browsers */
@media (max-width: 600px) {
    .chat-header {
        height: auto;
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .switch-label {
        font-size: 0.75rem;
    }
    
    .message-stream {
        padding: 1rem 0.5rem 2rem 0.5rem;
        gap: 1.25rem;
    }
    
    .bubble {
        max-width: 94%;
        padding: 0.85rem 1rem;
        border-radius: 12px;
    }
    
    .bot-avatar {
        width: 32px;
        height: 32px;
        margin-right: 0.5rem;
    }
    
    .thinking-container {
        padding: 0.5rem 0.5rem;
    }
    
    .bubble-body {
        font-size: 0.88rem;
    }
    
    .bubble-body pre {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .bubble-body code {
        font-size: 0.8rem;
    }
    
    .code-header {
        padding: 0.25rem 0.75rem;
        margin: -0.75rem -0.75rem 0.35rem -0.75rem;
    }
    
    .logo-area {
        font-size: 1.3rem;
    }
    
    .empty-state {
        padding: 1rem;
        max-width: 100%;
    }
}

/* Chat Input Container at the Bottom */
.chat-input-container {
    padding: 1.5rem 4rem;
    background: linear-gradient(180deg, transparent 0%, rgba(10, 11, 28, 0.9) 100%);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 5;
}

.chat-form {
    display: flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    box-shadow: var(--shadow-premium);
    /*     backdrop-filter: blur(16px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
    align-items: center;
    gap: 0.75rem;
}

.chat-form:focus-within {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 24px 0 rgba(139, 92, 246, 0.2);
}

.chat-form textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 0.5rem 0;
}

.chat-form textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.send-btn i {
    width: 18px;
    height: 18px;
}

/* Info status bar under input */
.input-info-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: 0.5rem;
}

.icon-tiny {
    width: 12px;
    height: 12px;
}

/* Mobile adjustments for input container bottom blocking (Optimized compact spacing!) */
@media (max-width: 768px) {
    .chat-input-container {
        padding: 0.5rem 0.75rem 0.5rem 0.75rem !important;
    }
}

/* Header Voice and Speed Controls */
.header-voice-select-container,
.header-speed-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
}

.header-voice-select-container:hover,
.header-speed-container:hover {
    border-color: rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.header-setting-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.premium-select-header {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.premium-select-header option {
    background: #0f112a;
    color: var(--text-primary);
}

.premium-range-header {
    -webkit-appearance: none;
    appearance: none;
    width: 75px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.premium-range-header::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
    transition: var(--transition-smooth);
}

.premium-range-header::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Adjust header layout for extreme cleanliness */
.chat-header {
    height: 70px;
    padding: 0 2rem 0 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 11, 28, 0.95); /* Opacity boosted */
    /*     backdrop-filter: blur(12px); (Disabled to prevent mobile GPU crash) */
    border-bottom: 1px solid var(--glass-border);
    z-index: 5;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-title-main {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: transparent;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.75) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}





/* ==========================================================================
   Mobile Responsive Adjustments (Ultra Streamlined 55px Header!)
   ========================================================================== */
@media (max-width: 900px) {
    .menu-toggle-floating {
        display: flex !important;
    }

    .chat-header {
        height: 55px !important;
        min-height: 55px !important;
        padding: 0 1rem 0 3.5rem !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }
    
    .header-left {
        width: auto !important;
        display: flex !important;
        align-items: center !important;
    }

    .header-right {
        width: auto !important;
        display: flex !important;
        justify-content: flex-end !important;
        gap: 0.85rem !important;
        border-top: none !important;
        padding-top: 0 !important;
    }
    
    .header-title-main {
        font-size: 0.95rem !important;
    }
    
    .switch-label {
        font-size: 0.72rem !important;
    }


}

@media (max-width: 600px) {
    .header-right {
        gap: 0.5rem !important;
    }
    
    .switch-label i {
        margin-right: 0.15rem !important;
    }
    
    .switch-label span,
    .switch-label {
        font-size: 0 !important;
    }
    
    .switch-label i {
        font-size: 0.95rem !important;
        color: var(--text-secondary) !important;
    }



    .console-input-bar {
        padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom)) 1rem !important;
    }
}



/* ==========================================================================
   Input Action Toolbar & Upload Styles
   ========================================================================== */
.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.25rem;
    margin-bottom: 0.15rem;
    font-size: 0.85rem;
    user-select: none;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-status-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-body);
    transition: color 0.3s ease;
}

.upload-status-text.uploading {
    color: var(--accent-purple);
    font-weight: 500;
}

.upload-status-text.success {
    color: #34d399;
    font-weight: 500;
}

.upload-status-text.error {
    color: #f87171;
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toolbar-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.35);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.1);
}

.toolbar-btn:active {
    transform: scale(0.97);
}

.toolbar-btn .icon-small {
    width: 13px;
    height: 13px;
}

.tts-highlight {
    background: linear-gradient(120deg, rgba(6, 182, 212, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
    border-radius: 2px;
    padding: 0;
    color: #fff;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.25);
    text-decoration: underline;
    text-decoration-color: var(--accent-cyan);
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    animation: pulseHighlight 1.5s infinite alternate ease-in-out;
    display: inline;
}

@keyframes pulseHighlight {
    0% {
        box-shadow: 0 0 6px rgba(6, 182, 212, 0.15);
    }
    100% {
        box-shadow: 0 0 14px rgba(6, 182, 212, 0.55);
    }
}

/* Long Message Folding */
.bubble-body.collapsed {
    max-height: 400px;
    overflow: hidden;
    position: relative;
}

.bubble-body.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to top, rgba(10, 11, 22, 0.95) 0%, rgba(10, 11, 22, 0) 100%);
    pointer-events: none;
}

/* User bubbles collapsed gradient matching background */
.chat-row.user-row .bubble-body.collapsed::after {
    background: linear-gradient(to top, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0) 100%);
}

.read-more-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    margin-left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-smooth);
}

.read-more-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: #fff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.read-more-btn:active {
    transform: scale(0.95);
}





/* ==========================================================================
   Premium login overlay (Deep Space Glassmorphism)
   ========================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: var(--vh, 100dvh);
    background: radial-gradient(circle at 50% 50%, rgba(22, 24, 61, 0.95) 0%, rgba(10, 11, 22, 0.98) 100%);
    /*     backdrop-filter: blur(25px); (Disabled to prevent mobile GPU crash) */
    /*     -webkit-backdrop-filter: blur(25px); (Disabled to prevent mobile GPU crash) */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 90%;
    max-width: 420px;
    background: rgba(18, 20, 48, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    padding: 2.5rem 2rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-glow {
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.login-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-purple);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ffffff;
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-input-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.login-input-group label i {
    width: 14px;
    height: 14px;
}

.login-input-field {
    background: rgba(10, 11, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: #ffffff;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.login-input-field:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
    background: rgba(10, 11, 25, 0.8);
}

.login-error-text {
    color: var(--accent-pink);
    font-size: 0.85rem;
    text-align: center;
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    display: block;
}

.login-error-text.hidden {
    display: none;
}

.login-submit-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: var(--border-radius-sm);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: var(--transition-smooth);
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.login-submit-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   Toolbox and Translation Functionality
   ========================================================================== */

.toolbox-menu-container {
    position: relative;
    display: inline-block;
}

.toolbox-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toolbox-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.toolbox-toggle-btn:active {
    transform: scale(0.95);
}

.toolbox-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: rgba(18, 20, 48, 0.95);
    /*     backdrop-filter: blur(20px) saturate(120%); (Disabled to prevent mobile GPU crash) */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2) inset;
    padding: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: settingsFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.toolbox-dropdown.hidden {
    display: none !important;
}

.toolbox-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.toolbox-dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toolbox-item-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.toolbox-item-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateX(3px);
}

/* Translate Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 6, 18, 0.75);
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

.translate-panel {
    background: rgba(18, 20, 48, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.translate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.translate-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.translate-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.translate-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.translate-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.translate-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.translate-lang-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.translate-select {
    background: rgba(10, 11, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: #fff;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.translate-select:focus {
    border-color: var(--accent-purple);
}

.translate-textarea {
    background: rgba(10, 11, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    color: #fff;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    height: 100px;
    outline: none;
    transition: var(--transition-smooth);
}

.translate-textarea:focus {
    border-color: var(--accent-purple);
    background: rgba(10, 11, 25, 0.8);
}

.translate-textarea[readonly] {
    background: rgba(255, 255, 255, 0.02);
    cursor: default;
}

.translate-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.translate-submit-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: var(--border-radius-sm);
    color: #fff;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.translate-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.translate-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.translate-copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-smooth);
}

.translate-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}



/* Antigravity Shortcuts Modal */
.antigravity-panel {
    background: rgba(18, 20, 48, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.antigravity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .antigravity-grid {
        grid-template-columns: 1fr;
    }
}

.antigravity-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: left;
}

.antigravity-card:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.1);
}

.antigravity-card:active {
    transform: scale(0.98);
}

.antigravity-card.executing {
    border-color: var(--accent-emerald) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2) !important;
}

.antigravity-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.antigravity-card:hover .antigravity-card-icon {
    background: var(--accent-purple);
    color: #fff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.antigravity-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.antigravity-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.antigravity-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* ==========================================================================
   Premium Select Trigger Button (inside Settings Dropdown)
   ========================================================================== */
.premium-select-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 0.55rem 1rem;
    color: #c084fc;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
}

.premium-select-trigger-btn:hover {
    border-color: rgba(139, 92, 246, 0.6);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

.premium-select-trigger-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   Premium Account Switcher Modal Popup
   ========================================================================== */
.premium-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 11, 28, 0.95); /* Opacity boosted */
    /*     backdrop-filter: blur(12px) saturate(140%); (Disabled to prevent mobile GPU crash) */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.premium-modal-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.premium-modal-box {
    background: rgba(18, 20, 48, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.15) inset;
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.premium-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-modal-title-group h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.modal-icon {
    color: var(--accent-purple);
    width: 20px;
    height: 20px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.premium-modal-body {
    padding: 1.2rem 1.5rem 1.5rem;
}

.modal-account-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Scrollbar styling for list */
.modal-account-list::-webkit-scrollbar {
    width: 4px;
}
.modal-account-list::-webkit-scrollbar-track {
    background: transparent;
}
.modal-account-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}
.modal-account-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Account card item styles */
.account-card {
    display: flex;
    align-items: center;
    background: rgba(15, 17, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
}

.account-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: all 0.2s ease;
}

.account-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateX(2px);
}

.account-card.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.account-card.active::before {
    background: var(--accent-purple);
}

.account-avatar {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.account-card.active .account-avatar {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
    border-color: transparent;
}

.account-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.account-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.account-card.active .account-name {
    color: #ffffff;
}

.account-role {
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.account-card.active .account-role {
    color: var(--accent-blue);
    opacity: 0.95;
}

.account-status-dot {
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.account-card.active .account-status-dot {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.account-card.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.account-card.loading .account-status-dot {
    background: transparent;
    border: 1.5px solid var(--accent-purple);
    border-top-color: transparent;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    animation: accountSpin 0.6s linear infinite;
    box-shadow: none;
}

@keyframes accountSpin {
    to { transform: rotate(360deg); }
}

/* Server Card Styles */
.server-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    position: relative;
}

.server-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.server-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.server-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.server-card-title span.server-name {
    font-weight: 700;
}

.server-card-title button.server-edit-name-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
}

.server-card-title button.server-edit-name-btn:hover {
    color: #fff;
}

.server-badges {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.server-status-badge {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.server-status-dot-inner {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    display: inline-block;
}

.server-type-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.server-type-badge.control-center {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--accent-purple);
}

.server-ips {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.15rem;
}

.server-ips span.ip-label {
    color: var(--text-muted);
}

.server-ips span.ip-val {
    color: #fff;
    margin-right: 0.25rem;
}

.server-spec {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.15rem;
}

.server-spec span.spec-val {
    font-weight: 600;
    color: #fff;
}

.server-created {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.server-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flex-row {
    margin-bottom: 0.75rem;
}

/* Server List Status & Separator */
.server-status-badge.stopped {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #f87171 !important;
}
.server-status-badge.stopped .server-status-dot-inner {
    background-color: #ef4444 !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8) !important;
}

/* Make stopped server cards semi-transparent to contrast with active ones */
.server-card:has(.server-status-badge.stopped) {
    opacity: 0.65;
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.02);
}
.server-card:has(.server-status-badge.stopped):hover {
    opacity: 0.85;
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.25);
}

.server-list-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin: 2rem 0 1.5rem 0;
    width: 100%;
}
.server-list-separator::before,
.server-list-separator::after {
    content: '';
    flex: 1;
    border-bottom: 2px dashed rgba(239, 68, 68, 0.35);
}
.server-list-separator::before {
    margin-right: 1.25rem;
}
.server-list-separator::after {
    margin-left: 1.25rem;
}

/* ==========================================================================
   Image Processing Modal
   ========================================================================== */
.image-panel {
    background: rgba(18, 20, 48, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 95%;
    max-width: 750px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.image-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 80vh;
    overflow-y: auto;
}

.image-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-md);
    padding: 3rem 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.image-dropzone:hover, .image-dropzone.dragover {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.05);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-purple);
    opacity: 0.8;
}

.dropzone-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.image-previews-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .image-previews-container {
        grid-template-columns: 1fr;
    }
}

.preview-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.size-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-primary);
}

.preview-box {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    border-radius: var(--border-radius-sm);
    aspect-ratio: 4/3;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-controls {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inline-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.inline-controls label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-control-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}

.toggle-control-label input[type="checkbox"] {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
    background: rgba(10, 11, 25, 0.6);
    transition: var(--transition-smooth);
}

.toggle-control-label input[type="checkbox"]:checked + .custom-checkbox {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
}

.toggle-control-label input[type="checkbox"]:checked + .custom-checkbox::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.slider-control-row {
    gap: 0.75rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

#img-quality-val {
    color: var(--accent-purple);
    font-family: monospace;
}

/* Global utility class to hide elements securely */
.hidden {
    display: none !important;
}

/* Premium Image Dropzone Custom Upload Button */
.dropzone-upload-btn {
    margin-top: 1.25rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--accent-purple, #8b5cf6), #7c3aed);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-md, 8px);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

.dropzone-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
    background: linear-gradient(135deg, #9b6bf7, #8b5cf6);
}

.dropzone-upload-btn:active {
    transform: translateY(0);
}

/* Upload Dropdown Menu Styles */
.upload-dropdown-container {
    position: relative;
    display: inline-block;
}

.upload-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(15, 23, 42, 0.85); /* Sleek dark slate background */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.35rem;
    min-width: 120px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.15); /* Purple accent glow */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 100;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-menu.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.upload-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.upload-menu-item:hover {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
}

.upload-menu-item i {
    width: 14px;
    height: 14px;
}

/* Custom Dropdown Option B styles */
.dropdown-option {
    text-align: left;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}
.dropdown-option:hover {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
}
.dropdown-option.active {
    background: var(--accent-purple);
    color: #fff;
}
