/* =============================================
   PERPLEXITY-STYLE DESIGN SYSTEM
   ============================================= */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-primary: #191A1A;
    --bg-secondary: #202222;
    --bg-sidebar: #191A1A;
    --bg-input: #2B2D2E;
    --bg-hover: #2B2D2E;
    --bg-card: #202222;
    --text-primary: #E8E8E8;
    --text-secondary: #9B9B9B;
    --text-muted: #6B6B6B;
    --border-color: #2B2D2E;
    --accent: #20B8CD;
    --accent-hover: #1CA3B5;
    --scrollbar-thumb: #3A3C3D;
    --scrollbar-track: transparent;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
    /* Glassmorphism tokens */
    --glass-bg: rgba(25, 26, 26, 0.65);
    --glass-bg-light: rgba(43, 45, 46, 0.5);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-border-hover: rgba(255, 255, 255, 0.1);
    --glass-blur: 16px;
    --glass-blur-heavy: 24px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* =============================================
   LAYOUT
   ============================================= */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
    backdrop-filter: blur(var(--glass-blur-heavy));
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 50;
}

.sidebar-header {
    padding: 16px 16px 8px;
}

.sidebar-new-thread {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.sidebar-new-thread:hover {
    background: var(--bg-hover);
}
.sidebar-new-thread svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.sidebar-nav-item.active {
    background: rgba(255, 255, 255, 0.07);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-weight: 500;
}
.sidebar-nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-section-label {
    padding: 16px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding: 12px;
}

.sidebar-powered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    transition: opacity 0.3s;
    opacity: 0.35;
}
.sidebar-powered:hover {
    opacity: 0.55;
}
.sidebar-powered-label {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.sidebar-powered-logo {
    height: 16px;
    filter: brightness(0.9);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.sidebar-user:hover {
    background: var(--bg-hover);
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-status {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.sidebar-user-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* =============================================
   WELCOME / HOME SCREEN (Perplexity-style)
   ============================================= */
.home-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 2rem;
}

.home-corp-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 18px;
    opacity: 0.35;
    transition: opacity 0.3s;
}
.home-corp-brand:hover {
    opacity: 0.55;
}
.home-corp-label {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.home-corp-logo {
    height: 16px;
    filter: brightness(0.9);
}

.home-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-align: center;
    opacity: 0.9;
}
.home-title-accent {
    color: var(--accent);
}
.home-tagline {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 4px;
    text-align: center;
}

/* Search/Input Box */
.home-input-container {
    width: 100%;
    max-width: 680px;
    position: relative;
}

/* Ambient Glow (YouTube-style) */
.ambient-glow {
    position: absolute;
    inset: -40%;
    z-index: -1;
    border-radius: 50%;
    opacity: 0.35;
    filter: blur(80px);
    pointer-events: none;
    background: radial-gradient(
        ellipse at 50% 50%,
        rgba(32, 184, 205, 0.4) 0%,
        rgba(99, 102, 241, 0.25) 35%,
        rgba(139, 92, 246, 0.15) 60%,
        transparent 80%
    );
    animation: ambientPulse 6s ease-in-out infinite alternate;
}
.ambient-glow::after {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: radial-gradient(
        ellipse at 60% 40%,
        rgba(59, 130, 246, 0.3) 0%,
        rgba(32, 184, 205, 0.2) 40%,
        transparent 70%
    );
    animation: ambientShift 8s ease-in-out infinite alternate-reverse;
}
@keyframes ambientPulse {
    0%   { opacity: 0.3; transform: scale(1); }
    50%  { opacity: 0.42; transform: scale(1.05); }
    100% { opacity: 0.32; transform: scale(0.97); }
}
@keyframes ambientShift {
    0%   { transform: translateX(-5%) translateY(5%) scale(1); }
    100% { transform: translateX(5%) translateY(-5%) scale(1.08); }
}

/* Ambient Response Glow (chat view) */
.chat-ambient {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    filter: blur(120px);
    transition: opacity 0.6s ease;
    background: radial-gradient(
        circle,
        rgba(32, 184, 205, 0.35) 0%,
        rgba(99, 102, 241, 0.2) 40%,
        transparent 70%
    );
}

/* Thinking state — subtle pulse */
.chat-ambient.thinking {
    opacity: 0.25;
    animation: ambientThinking 2s ease-in-out infinite;
}
@keyframes ambientThinking {
    0%, 100% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.9); }
    50%      { opacity: 0.35; transform: translate(-50%, -50%) scale(1.05); }
}

/* Response arrived — bright flash then color cycle */
.chat-ambient.responding {
    opacity: 0.5;
    animation: ambientRespond 3s ease-out forwards;
}
@keyframes ambientRespond {
    0%   { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2);
           background: radial-gradient(circle, rgba(32, 184, 205, 0.5) 0%, rgba(99, 102, 241, 0.3) 40%, transparent 70%); }
    30%  { opacity: 0.45; transform: translate(-50%, -50%) scale(1.05);
           background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, rgba(139, 92, 246, 0.25) 40%, transparent 70%); }
    60%  { opacity: 0.35; transform: translate(-50%, -50%) scale(1);
           background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, rgba(32, 184, 205, 0.2) 40%, transparent 70%); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

.home-input-box {
    background: var(--glass-bg-light);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: var(--glass-shadow);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.home-input-box:focus-within {
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow), 0 0 0 1px rgba(32, 184, 205, 0.15);
    background: rgba(43, 45, 46, 0.65);
}

.home-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font-family);
    resize: none;
    min-height: 24px;
    max-height: 200px;
    line-height: 1.5;
}
.home-textarea::placeholder {
    color: var(--text-muted);
}

.home-input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.home-input-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.home-input-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.home-input-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.home-input-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.model-selector:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.6;
}
.send-btn:hover {
    opacity: 1;
    transform: scale(1.05);
}
.send-btn.active {
    opacity: 1;
}
.send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* Quick Action Chips */
.home-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 680px;
}

.home-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(43, 45, 46, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.home-chip:hover {
    border-color: var(--glass-border-hover);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.home-chip svg {
    width: 14px;
    height: 14px;
    opacity: 0.6;
}

/* =============================================
   CHAT CONVERSATION VIEW
   ============================================= */
.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Perplexity-style Tabs Bar */
.chat-tabs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    min-height: 52px;
    border-bottom: 1px solid var(--glass-border);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}
.chat-tabs-left {
    display: flex;
    align-items: center;
    gap: 0;
}
.chat-tabs-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.chat-tab:hover {
    color: var(--text-secondary);
}
.chat-tab.active {
    color: var(--text-primary);
}
.chat-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}
.chat-tab svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.chat-tab-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.chat-tab-more:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.chat-share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
}
.chat-share-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: var(--glass-border-hover);
}
.chat-share-btn svg {
    width: 14px;
    height: 14px;
}

.chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #111212;
}

.chat-message-group {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 24px;
}

/* User question bubble (right-aligned) */
.chat-user-row {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 24px;
}
.chat-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a4a4a, #6b6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    order: 0;
}
.chat-user-bubble {
    background: var(--bg-input);
    border-radius: 18px 18px 4px 18px;
    padding: 10px 18px;
    font-size: 15px;
    color: var(--text-primary);
    max-width: 70%;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-question {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.3;
}

.chat-answer {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-secondary);
}
.chat-answer p { margin-bottom: 12px; }
.chat-answer p:last-child { margin-bottom: 0; }
.chat-answer strong { color: var(--text-primary); }
.chat-answer em { color: var(--text-primary); font-style: italic; }
.chat-answer code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.chat-answer pre {
    background: rgba(32, 34, 34, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    overflow-x: auto;
    font-size: 13px;
}
.chat-answer pre code {
    background: transparent;
    padding: 0;
}
.chat-answer ul, .chat-answer ol {
    padding-left: 24px;
    margin: 8px 0;
}
.chat-answer li { margin-bottom: 4px; }

.chat-answer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.chat-answer-header svg {
    width: 16px;
    height: 16px;
}

/* Perplexity-style action buttons (left + right) */
.chat-answer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 0;
}
.chat-actions-left,
.chat-actions-right {
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}
.chat-action-btn svg {
    width: 16px;
    height: 16px;
}

.chat-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

/* Bottom input in chat view */
.chat-bottom-input {
    border-top: 1px solid var(--glass-border);
    padding: 16px 24px 20px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
    backdrop-filter: blur(var(--glass-blur-heavy));
}
.chat-bottom-input .home-input-container {
    margin: 0 auto;
}

/* Typing animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingPulse 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingPulse {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* =============================================
   AUTH PAGES (Login / Register)
   ============================================= */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

#particles-js {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    z-index: 1;
    background: rgba(25, 26, 26, 0.55);
    -webkit-backdrop-filter: blur(var(--glass-blur-heavy));
    backdrop-filter: blur(var(--glass-blur-heavy));
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
}

.auth-corp-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 1.5rem;
    opacity: 0.4;
    transition: opacity 0.3s;
}
.auth-corp-brand.auth-corp-bottom {
    margin-top: 1.5rem;
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-corp-brand:hover {
    opacity: 0.6;
}
.auth-corp-label {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.auth-corp-logo {
    height: 16px;
    filter: brightness(0.9);
}

.auth-logo {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.auth-logo-accent {
    color: var(--accent);
}
.auth-tagline {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-form {
    text-align: left;
}

.auth-field {
    margin-bottom: 16px;
}
.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.auth-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(43, 45, 46, 0.4);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}
.auth-input::placeholder {
    color: var(--text-muted);
}
.auth-input:focus {
    border-color: var(--accent);
}

.auth-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.auth-btn:hover {
    background: var(--accent-hover);
}
.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
}
.auth-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}
.auth-divider-text {
    padding: 0 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.auth-link-btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.auth-link-btn:hover {
    border-color: var(--glass-border-hover);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: #f87171;
    font-size: 13px;
}

.auth-success {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    color: #4ade80;
    font-size: 13px;
}

.auth-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 4px;
    margin-bottom: 8px;
}

.auth-forgot-link {
    font-size: 12px;
    color: var(--accent);
    transition: opacity 0.15s;
}
.auth-forgot-link:hover {
    opacity: 0.8;
}

.auth-pin-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    text-align: center;
}
.auth-pin-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.auth-pin-info strong {
    color: var(--text-primary);
    font-size: 15px;
}
.auth-pin-timer {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.auth-pin-timer span {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* PIN input */
.pin-input {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5em;
    padding-left: 20px;
    font-variant-numeric: tabular-nums;
}

/* Password toggle */
.pw-wrap {
    position: relative;
}
.pw-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}
.pw-toggle:hover {
    color: var(--text-secondary);
}

/* Password strength */
.pw-strength-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    height: 3px;
    margin-top: 8px;
}
.pw-strength-bar > div {
    border-radius: 999px;
    background: var(--border-color);
    transition: background 0.3s;
}

/* =============================================
   404 PAGE
   ============================================= */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
}
.error-code {
    font-size: 6rem;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0.3;
}
.error-message {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}
.error-btn {
    padding: 10px 24px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(43, 45, 46, 0.3);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.error-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--glass-border-hover);
}

/* =============================================
   MOBILE RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 40;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    .home-title {
        font-size: 2rem;
    }
}
@media (min-width: 769px) {
    .mobile-menu-btn {
        display: none !important;
    }
    .sidebar-overlay {
        display: none !important;
    }
}

/* =============================================
   IMAGE PREVIEW
   ============================================= */
.image-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 4px;
    border-bottom: 1px solid var(--glass-border);
}
.image-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}
.image-preview-remove {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.image-preview-remove:hover {
    background: rgba(255,80,80,0.2);
    color: #ff5050;
}
.chat-user-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
}

/* =============================================
   REASONING BLOCK
   ============================================= */
.chat-reasoning {
    margin-bottom: 12px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(32, 184, 205, 0.04);
    overflow: hidden;
}
.chat-reasoning summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background 0.2s;
}
.chat-reasoning summary::-webkit-details-marker {display:none;}
.chat-reasoning summary::after {
    content: '';
    margin-left: auto;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--accent);
    transition: transform 0.2s;
}
.chat-reasoning[open] summary::after {
    transform: rotate(180deg);
}
.chat-reasoning summary:hover {
    background: rgba(32, 184, 205, 0.08);
}
.chat-reasoning-content {
    padding: 10px 14px 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-top: 1px solid var(--glass-border);
}

/* =============================================
   METADATA BADGES
   ============================================= */
.chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.chat-meta span {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
}
.chat-meta-plan {
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =============================================
   VIDEO GENERATION (SORA)
   ============================================= */
.home-chip-video {
    border-color: rgba(139, 92, 246, 0.3);
    color: #a78bfa;
}
.home-chip-video:hover {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.08);
}
.video-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    margin-right: 6px;
    vertical-align: middle;
}
.video-generating {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}
.video-gen-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #a78bfa;
    animation: videoSpin 1s linear infinite;
    flex-shrink: 0;
}
@keyframes videoSpin {
    to { transform: rotate(360deg); }
}
.video-gen-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.video-gen-text strong {
    color: #a78bfa;
    font-size: 14px;
}
.video-gen-text span {
    color: var(--text-muted);
    font-size: 12px;
}
.video-player-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}
.chat-video-player {
    width: 100%;
    max-width: 560px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: #000;
}
.video-download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.25);
    text-decoration: none;
    width: fit-content;
    transition: all 0.2s;
}
.video-download-link:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
}

/* =============================================
   LICENCIAS / PAYMENTS PAGE
   ============================================= */
.licencias-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}
.lic-corp-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 0;
    opacity: 0.4;
    transition: opacity 0.3s;
}
.lic-corp-brand:hover {
    opacity: 0.6;
}
.lic-corp-label {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.lic-corp-logo {
    height: 16px;
    filter: brightness(0.9);
}

.lic-header {
    text-align: center;
    margin-bottom: 36px;
}
.lic-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.lic-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
}
/* Plans Grid */
.lic-plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
@media (max-width: 768px) {
    .lic-plans-grid { grid-template-columns: 1fr; }
}
.lic-plan-card {
    position: relative;
    padding: 28px 22px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}
.lic-plan-card:hover {
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
}
.lic-plan-card.lic-plan-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 4px 24px rgba(32, 184, 205, 0.12);
}
.lic-plan-pro {
    border-color: rgba(32, 184, 205, 0.3);
}
.lic-plan-enterprise {
    border-color: rgba(139, 92, 246, 0.3);
}
.lic-plan-badge, .lic-plan-badge-free, .lic-plan-badge-ent {
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
}
.lic-plan-badge {
    background: var(--accent);
    color: #000;
}
.lic-plan-badge-free {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}
.lic-plan-badge-ent {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.lic-plan-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 8px 0 12px;
}
.lic-plan-price {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}
.lic-plan-price span {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
}
.lic-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}
.lic-plan-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}
.lic-plan-features li svg {
    color: var(--accent);
    flex-shrink: 0;
}
.lic-feat-disabled {
    opacity: 0.4;
}
.lic-feat-disabled svg {
    color: var(--text-muted) !important;
}
.lic-plan-select-btn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.lic-plan-select-btn:hover {
    background: rgba(32, 184, 205, 0.1);
}
.lic-btn-ent {
    border-color: #a78bfa;
    color: #a78bfa;
}
.lic-btn-ent:hover {
    background: rgba(139, 92, 246, 0.1);
}
/* Payment Section */
.lic-payment-section {
    margin-top: 8px;
}
.lic-payment-card {
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}
.lic-payment-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}
.lic-payment-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 20px;
    line-height: 1.5;
}
.lic-plan-selected-info {
    margin-bottom: 20px;
}
.lic-plan-selected-info,
.lic-plan-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(32, 184, 205, 0.06);
    border: 1px solid rgba(32, 184, 205, 0.2);
    margin-bottom: 20px;
    font-size: 14px;
}
.lic-sel-label {
    color: var(--text-secondary);
}
.lic-sel-plan {
    color: var(--accent);
    font-weight: 600;
}
.lic-sel-price {
    margin-left: auto;
    color: var(--text-primary);
    font-weight: 600;
}
/* QR Section */
.lic-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.02);
}
.lic-qr-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}
.lic-qr-img {
    max-width: 220px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}
/* Dropzone */
.lic-dropzone {
    border: 2px dashed var(--glass-border);
    border-radius: 14px;
    padding: 32px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lic-dropzone:hover, .lic-dropzone-hover {
    border-color: var(--accent);
    background: rgba(32, 184, 205, 0.04);
}
.lic-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}
.lic-dropzone-content svg {
    color: var(--text-secondary);
}
.lic-dropzone-content span {
    font-size: 14px;
}
.lic-dropzone-content small {
    font-size: 12px;
    opacity: 0.6;
}
.lic-dropzone-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
}
.lic-dropzone-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    object-fit: contain;
}
.lic-remove-voucher {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255,80,80,0.15);
    color: #ff5050;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.lic-remove-voucher:hover {
    background: rgba(255,80,80,0.3);
}
/* Submit button */
.lic-submit-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--glass-bg-light);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.lic-submit-btn.active {
    background: var(--accent);
    color: #000;
    cursor: pointer;
}
.lic-submit-btn.active:hover {
    filter: brightness(1.1);
}
.lic-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: #000;
    border-radius: 50%;
    animation: videoSpin 0.8s linear infinite;
}
/* Status messages */
.lic-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 16px;
}
.lic-status-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.lic-status-error {
    background: rgba(255, 80, 80, 0.1);
    border: 1px solid rgba(255, 80, 80, 0.3);
    color: #ff6b6b;
}
/* Plans loading state */
.lic-plans-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.lic-plans-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid var(--glass-border);
    border-top-color: var(--accent);
    animation: videoSpin 1s linear infinite;
}

/* =============================================
   DEEP RESEARCH
   ============================================= */
.home-chip-research {
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.home-chip-research:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.08);
}
.research-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    margin-right: 6px;
    vertical-align: middle;
}
.research-generating {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid rgba(16, 185, 129, 0.2);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}
.research-orbit {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(16, 185, 129, 0.15);
    position: relative;
    flex-shrink: 0;
    animation: researchOrbit 2s linear infinite;
}
.research-orbit-dot {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}
@keyframes researchOrbit {
    to { transform: rotate(360deg); }
}
.research-gen-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.research-gen-text strong {
    color: #34d399;
    font-size: 14px;
}
.research-gen-text span {
    color: var(--text-muted);
    font-size: 12px;
}
.research-timer {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px !important;
    color: #34d399 !important;
    font-weight: 600;
    margin-top: 2px;
}
.research-answer {
    border-left: 3px solid rgba(16, 185, 129, 0.4);
    padding-left: 16px;
}

/* =============================================
   TTS / STT STATES
   ============================================= */
/* Mic recording pulse */
.mic-btn.recording {
    color: #ff4444;
    animation: micPulse 1s ease-in-out infinite;
    background: rgba(255, 68, 68, 0.12);
    border-radius: 50%;
}
@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 68, 68, 0); }
}
.mic-btn.mic-processing {
    color: var(--accent);
    animation: micSpin 1s linear infinite;
}
@keyframes micSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* TTS speaker button states */
.chat-action-btn.tts-loading {
    opacity: 0.5;
    pointer-events: none;
    animation: ttsPulse 0.8s ease-in-out infinite;
}
@keyframes ttsPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}
.chat-action-btn.tts-playing {
    color: var(--accent);
    background: rgba(32, 184, 205, 0.12);
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Spinner */
.spinner {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================
   MODEL BADGE (static)
   ============================================= */
.model-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--accent, #20B8CD);
    background: rgba(32, 184, 205, 0.08);
    border: 1px solid rgba(32, 184, 205, 0.18);
    border-radius: 6px;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

/* =============================================
   VOTE BUTTONS
   ============================================= */
.chat-vote-btn.voted-up {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
}
.chat-vote-btn.voted-up svg {
    fill: #34d399;
    stroke: #34d399;
}
.chat-vote-btn.voted-down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}
.chat-vote-btn.voted-down svg {
    fill: #f87171;
    stroke: #f87171;
}

/* =============================================
   MORE OPTIONS MENU
   ============================================= */
.more-options-menu,
.header-more-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--glass-bg, rgba(30, 32, 38, 0.95));
    border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    border-radius: 10px;
    backdrop-filter: blur(16px);
    padding: 6px;
    min-width: 170px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    animation: fadeIn 0.15s ease-out;
}
.header-more-menu {
    top: calc(100% + 6px);
    bottom: auto;
}
.more-options-menu button,
.header-more-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #a0a5b1);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.more-options-menu button:hover,
.header-more-menu button:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* =============================================
   TAB EMPTY STATES
   ============================================= */
.tab-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    font-size: 14px;
}
.tab-image-gallery {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    justify-content: flex-start;
}
.tab-gallery-img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    transition: transform 0.2s, box-shadow 0.2s;
}
.tab-gallery-img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* =============================================
   TOAST NOTIFICATION
   ============================================= */
.ia-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--glass-bg, rgba(30, 32, 38, 0.95));
    border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    color: #fff;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 13px;
    z-index: 10000;
    opacity: 0;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.ia-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =============================================
   SIDEBAR PANEL OVERLAY
   ============================================= */
.sidebar-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}
.sidebar-panel {
    background: var(--glass-bg, rgba(30, 32, 38, 0.98));
    border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    border-radius: 16px;
    width: 400px;
    max-width: 90vw;
    max-height: 70vh;
    overflow: auto;
    backdrop-filter: blur(20px);
    box-shadow: 0 16px 64px rgba(0,0,0,0.5);
}
.sidebar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    color: #fff;
    font-size: 15px;
}
.sidebar-panel-close {
    background: transparent;
    border: none;
    color: var(--text-muted, #6b7280);
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.sidebar-panel-close:hover {
    color: #fff;
}
.sidebar-panel-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
    line-height: 1.6;
}

/* =============================================
   HISTORY LIST
   ============================================= */
.history-list {
    padding: 8px;
    max-height: 60vh;
    overflow-y: auto;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.history-item:last-child {
    border-bottom: none;
}
.history-item:hover {
    background: rgba(255,255,255,0.06);
}
.history-item-content {
    flex: 1;
    min-width: 0;
}
.history-item-title {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item-meta {
    color: var(--text-muted, #6b7280);
    font-size: 11px;
    margin-top: 3px;
}
.history-item-delete {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.history-item:hover .history-item-delete {
    opacity: 1;
}
.history-item-delete:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
}

/* Account Panel */
.account-panel {
    max-width: 380px;
}
.account-panel-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 24px;
    text-align: center;
}
.account-avatar-big {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #20B8CD, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    text-transform: uppercase;
}
.account-name {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 4px;
}
.account-email {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 20px;
}
.account-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid;
    margin-bottom: 28px;
}
.account-upgrade-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.account-upgrade-text {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
    font-size: 13px;
    color: #cbd5e1;
    line-height: 1.5;
    padding: 12px 16px;
    background: rgba(167, 139, 250, 0.06);
    border: 1px solid rgba(167, 139, 250, 0.12);
    border-radius: 12px;
}
.account-upgrade-text svg {
    flex-shrink: 0;
    margin-top: 2px;
}
.account-upgrade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed, #6d28d9);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(167, 139, 250, 0.3);
}
.account-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(167, 139, 250, 0.45);
    filter: brightness(1.1);
}
.account-current-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #94a3b8;
}
.account-manage-link {
    color: #20B8CD;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}
.account-manage-link:hover {
    text-decoration: underline;
}

/* Custom Prompt Modal */
.custom-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.custom-prompt-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.custom-prompt-modal {
    background: var(--glass-bg, rgba(30, 35, 50, 0.95));
    border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
    border-radius: 16px;
    padding: 28px 28px 20px;
    width: 90%;
    max-width: 460px;
    text-align: center;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.custom-prompt-overlay.active .custom-prompt-modal {
    transform: scale(1) translateY(0);
}
.custom-prompt-icon {
    margin-bottom: 12px;
}
.custom-prompt-title {
    font-size: 18px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 6px;
}
.custom-prompt-desc {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 18px;
    line-height: 1.5;
}
.custom-prompt-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #f1f5f9;
    font-size: 14px;
    padding: 12px 14px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.custom-prompt-input:focus {
    outline: none;
    border-color: rgba(32, 184, 205, 0.4);
}
.custom-prompt-input::placeholder {
    color: #64748b;
}
.custom-prompt-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.custom-prompt-cancel {
    flex: 1;
    padding: 10px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.custom-prompt-cancel:hover {
    background: rgba(255,255,255,0.1);
    color: #f1f5f9;
}
.custom-prompt-submit {
    flex: 2;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    background: linear-gradient(135deg, #20B8CD, #1a9aaa);
}
.custom-prompt-submit:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.custom-prompt-submit.btn-video {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
}
.custom-prompt-submit.btn-research {
    background: linear-gradient(135deg, #20B8CD, #0d9488);
}
