/* ==========================================================================
   Astra AI - RichiDev Technology Premium Stylesheet
   ========================================================================== */

/* Design Tokens & Variables */
:root {
    --bg-dark: #060913;
    --bg-sidebar: rgba(10, 17, 36, 0.75);
    --bg-chat: rgba(8, 12, 26, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(37, 99, 235, 0.15);
    
    /* Harmonious Navy/Cyan Accents */
    --accent-purple: #2563eb;
    --accent-purple-glow: rgba(37, 99, 235, 0.4);
    --accent-cyan: #00d2ff;
    --accent-cyan-glow: rgba(0, 210, 255, 0.4);
    --accent-gradient: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
    
    /* Text Colors */
    --text-primary: #f3f4f6;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-blur: blur(20px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
    
    /* Fonts */
    --font-primary: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-secondary: 'Plus Jakarta Sans', system-ui, sans-serif;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables Fallback */
[data-theme="light"] {
    --bg-dark: #f1f5f9;
    --bg-sidebar: rgba(226, 232, 240, 0.85);
    --bg-chat: rgba(248, 250, 252, 0.8);
    --border-color: rgba(15, 23, 42, 0.08);
    --border-glow: rgba(37, 99, 235, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: 1px solid rgba(15, 23, 42, 0.06);
    --accent-purple-glow: rgba(37, 99, 235, 0.15);
    --accent-cyan-glow: rgba(0, 210, 255, 0.15);
}

/* Reset & Global Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    text-rendering: optimizeSpeed; /* Acelera el dibujo de fuentes */
}

/* Premium Gradient Mesh Background */
.bg-gradient-mesh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
    background: radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.08) 0%, transparent 45%),
                radial-gradient(circle at 90% 80%, rgba(0, 210, 255, 0.06) 0%, transparent 45%),
                radial-gradient(circle at 50% 50%, rgba(6, 9, 19, 0.3) 0%, transparent 50%);
    background-size: cover;
    pointer-events: none;
}

/* Subtle Sci-Fi Noise Overlay */
.bg-noise {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* Hardware Accelerated Cosmos Particles Canvas */
#cosmos-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -15; /* Sits behind app container but above background mesh */
    pointer-events: none;
    transform: translate3d(0, 0, 0); /* Force GPU acceleration */
    backface-visibility: hidden;
}

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

/* ==========================================================================
   Sidebar Component
   ========================================================================== */
.sidebar {
    width: 300px;
    height: 100%;
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform var(--transition-smooth);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-container {
    position: relative;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border-radius: 12px;
    border: var(--glass-border);
    overflow: hidden;
}

.brand-logo-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0.15;
    filter: blur(4px);
    transition: opacity var(--transition-fast);
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    transition: transform var(--transition-fast);
}

.brand:hover .brand-logo-img {
    transform: scale(1.08);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fff 30%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-name {
    background: linear-gradient(135deg, #000 30%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-sub {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent-cyan);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mobile-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

/* "New Chat" Interactive Button */
.new-chat-btn {
    margin: 8px 24px 16px;
    padding: 14px 20px;
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.new-chat-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-smooth);
    z-index: 0;
}

.new-chat-btn > * {
    position: relative;
    z-index: 1;
}

.new-chat-btn:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 15px var(--accent-purple-glow);
    transform: translateY(-2px);
}

.new-chat-btn:hover::before {
    opacity: 0.08;
}

/* Sidebar Navigation Items */
.sidebar-nav {
    flex: 1;
    padding: 0 16px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 12px 12px 6px;
}

.chat-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.history-item.active {
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-purple);
    font-weight: 500;
}

.delete-chat-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-item:hover .delete-chat-btn {
    opacity: 0.7;
}

.history-item:hover .delete-chat-btn:hover {
    opacity: 1;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Sidebar Footer & User Profile */
.sidebar-footer {
    padding: 16px 20px;
    border-top: var(--glass-border);
    background: rgba(10, 10, 15, 0.3);
}

.footer-action-btn {
    width: 100%;
    padding: 12px;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all var(--transition-fast);
}

.footer-action-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 4px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Main Content & Chat Layout
   ========================================================================== */
.main-content {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* App Header Component */
.app-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: var(--glass-border);
    background: rgba(10, 10, 15, 0.2);
    backdrop-filter: var(--glass-blur);
    z-index: 5;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    background: rgba(255, 255, 255, 0.04);
    border: var(--glass-border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-cyan);
    letter-spacing: 0.5px;
}

.status-indicator {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-purple);
    transform: translateY(-1px);
}

/* Chat Container & Welcome Screen */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background: var(--bg-chat);
}

.welcome-screen {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.welcome-logo {
    position: relative;
    width: 88px;
    height: 88px;
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    margin-bottom: 28px;
}

.welcome-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
    z-index: 2;
    transition: transform var(--transition-smooth);
}

.welcome-logo:hover .welcome-logo-img {
    transform: scale(1.08) rotate(3deg);
}

.logo-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    background: var(--accent-gradient);
    opacity: 0.15;
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.15; }
    50% { transform: scale(1.12); opacity: 0.3; filter: blur(6px); }
    100% { transform: scale(1); opacity: 0.15; }
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 40px;
}

.welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
}

.suggestion-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 22px;
    border-radius: 16px;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.suggestion-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-smooth);
    pointer-events: none;
}

.suggestion-card:hover {
    border-color: rgba(0, 210, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25), 0 0 20px rgba(0, 210, 255, 0.05);
}

.suggestion-card:hover::before {
    opacity: 0.04;
}

.card-icon {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.suggestion-card h3 {
    font-size: 0.98rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.suggestion-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ==========================================================================
   Chat Messages & Styling
   ========================================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    /* Performance: don't use smooth scroll during streaming — instant is faster */
    scroll-behavior: auto;
    overscroll-behavior: contain;
    /* GPU layer for smooth scrolling */
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
}

.message-wrapper {
    display: flex;
    gap: 16px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    animation: messageIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.message-wrapper.user .message-avatar {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--accent-cyan);
}

.message-wrapper.assistant .message-avatar {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 10px var(--accent-purple-glow);
}

.message-bubble {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.95rem;
    word-break: break-word;
    overflow-wrap: break-word;
    position: relative;
    /* GPU-accelerated compositing for smooth streaming */
    will-change: contents;
    contain: layout style;
}

/* ── Markdown rendered elements inside bubbles ── */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
    margin: 14px 0 6px;
    line-height: 1.3;
}
.message-bubble ul,
.message-bubble ol {
    padding-left: 20px;
    margin: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.message-bubble li {
    line-height: 1.6;
    font-size: 0.94rem;
}
.message-bubble blockquote {
    margin: 10px 0;
}
.message-bubble hr {
    margin: 12px 0;
}
.message-bubble strong {
    font-weight: 700;
    color: var(--text-primary);
}
.message-bubble em {
    color: var(--accent-cyan);
    font-style: italic;
}
.message-bubble code {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: 0.85rem;
    color: #e5c07b;
}

.message-wrapper.user .message-bubble {
    background: rgba(0, 210, 255, 0.04);
    border-color: rgba(0, 210, 255, 0.12);
    box-shadow: none;
}

.message-wrapper.assistant .message-bubble {
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
    padding-right: 48px; /* Safe padding for speaker button on the right */
}

/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 6px 0;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typingPulse 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* Code Syntax & Preformatted Styling */
pre {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 14px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid rgba(255,255,255,0.05);
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.88rem;
    color: #e5c07b; /* Elegant Gold Code Tone */
}

/* ==========================================================================
   Chat Input Form Section
   ========================================================================== */
.chat-input-wrapper {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px 24px;
}

.chat-input-form {
    background: rgba(13, 20, 38, 0.75);
    backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid rgba(0, 210, 255, 0.15);
    border-radius: 20px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.chat-input-form:focus-within {
    border-color: rgba(0, 210, 255, 0.45);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 25px rgba(0, 210, 255, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    resize: none;
    max-height: 200px;
    padding: 10px 6px;
    min-height: 40px;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.chat-input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

/* Outlined icon buttons inside the input form */
.chat-input-form .header-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.chat-input-form .header-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #00d2ff !important;
    border-color: rgba(0, 210, 255, 0.25) !important;
    transform: translateY(-1px);
}

.input-actions {
    display: flex;
    align-items: center;
}

.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #00b4db, #0083b0);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 180, 219, 0.3);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(0, 180, 219, 0.45);
}

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

.input-info {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 10px;
    letter-spacing: 0.2px;
}

/* ==========================================================================
   Modals & Settings Component
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: rgba(13, 13, 21, 0.95);
    border: var(--glass-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px var(--border-glow);
    border-radius: 20px;
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-smooth);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    border-bottom: var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-label {
    display: flex;
    flex-direction: column;
}

.settings-label span:first-child {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

.settings-input, .settings-textarea, .settings-select {
    width: 100%;
    background: #0f172a;
    border: var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast);
    outline: none;
}

.settings-select option {
    background: #0f172a;
    color: #ffffff;
}

.settings-input:focus, .settings-textarea:focus, .settings-select:focus {
    border-color: var(--accent-purple);
}

.settings-textarea {
    min-height: 80px;
    resize: vertical;
}

.settings-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-footer {
    padding: 16px 24px;
    border-top: var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-btn.primary {
    background: var(--accent-gradient);
    border: none;
    color: white;
    box-shadow: 0 4px 12px var(--accent-purple-glow);
}

.modal-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-purple-glow);
}

.modal-btn.secondary {
    background: var(--glass-bg);
    border: var(--glass-border);
    color: var(--text-primary);
}

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Responsive & Adaptive Breakpoints
   ========================================================================== */
/* Sidebar Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile responsive table wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 85vw;
        max-width: 320px;
        transform: translateX(-100%);
        z-index: 100;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .mobile-toggle, .mobile-close {
        display: block;
    }
    
    .welcome-title {
        font-size: 1.8rem;
    }
    
    .app-header {
        padding: 0 12px;
    }

    #zen-mode-toggle, #export-pdf-btn {
        display: none; /* Ocultar botones no esenciales en móvil */
    }

    .agent-indicator {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* 📱 Mejoras Móviles para Modales y Chat */
    .modal-overlay {
        padding: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .auth-card, .modal-card {
        width: 100%;
        max-width: 95vw;
        padding: 20px;
        margin: auto;
        max-height: 85vh;
        overflow-y: auto;
        border-radius: 16px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(0, 210, 255, 0.15);
    }

    /* Scaling inputs perfectly on mobile to prevent iOS Safari zoom */
    textarea.chat-input, input.settings-input, select.settings-select, textarea.settings-textarea {
        font-size: 16px !important;
    }
    
    .chat-messages {
        padding: 16px 12px;
    }

    .message-wrapper {
        gap: 10px;
    }

    .chat-input-wrapper {
        padding: 8px 12px;
        margin: 0;
        max-width: 100%;
    }
    
    .chat-input-form {
        padding: 6px 10px;
    }
    
    .header-title .badge {
        display: none;
    }

    .artifact-panel.open {
        width: 100vw;
        position: fixed;
        inset: 0;
        z-index: 200;
    }

    .yape-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    /* Lightbox mobile adjustments */
    .lightbox-close {
        top: 16px;
        right: 20px;
        font-size: 2.5rem;
    }
    .lightbox-caption {
        font-size: 0.85rem;
        margin-top: 12px;
    }
}

@media (min-width: 769px) {
    .yape-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .welcome-title { font-size: 1.5rem; }
    .welcome-subtitle { font-size: 0.85rem; }
    .chat-input-wrapper { padding: 6px; }
    .agent-indicator { display: none; } /* Mucho más limpio en pantallas muy pequeñas */
    
    .yape-grid { 
        grid-template-columns: 1fr !important; 
        gap: 10px !important;
    }
    
    .auth-card { padding: 16px; }
}

/* Elegant Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
}

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

/* ==========================================================================
   Full-Stack Auth & Verification Interfaces
   ========================================================================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #04060d;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.auth-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.auth-card {
    background: rgba(10, 17, 36, 0.95);
    border: var(--glass-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 30px var(--border-glow);
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.auth-logo-container {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    padding: 2px;
    background: var(--accent-gradient);
    box-shadow: 0 0 20px var(--accent-purple-glow);
    margin-bottom: 24px;
    overflow: hidden;
}

.auth-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.auth-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 28px;
}

.form-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 8px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 24px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-purple-glow);
}

.auth-switch {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
    transition: color var(--transition-fast);
}

.auth-switch a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ==========================================================================
   Admin Users Database Table Styling
   ========================================================================== */
.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.admin-users-table th {
    background: rgba(255,255,255,0.03);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: var(--glass-border);
}

.admin-users-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.admin-users-table tr:hover {
    background: rgba(255,255,255,0.01);
}

/* User Badges */
.admin-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.admin-badge.admin {
    background: rgba(0, 210, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 210, 255, 0.2);
}

.admin-badge.user {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-badge.confirmed {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.admin-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Admin Actions */
.admin-delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.admin-delete-btn:hover {
    background: #ef4444;
    color: white;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Voice Input active states */
.mic-active {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
    animation: micPulse 1.5s infinite ease-in-out;
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 0 0 0px rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* Speak buttons on messages */
.speak-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 5;
}

.speak-btn:hover {
    background: var(--accent-cyan-glow);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: scale(1.05);
}

.speak-btn.speaking {
    background: rgba(0, 210, 255, 0.2);
    border-color: rgba(0, 210, 255, 0.5);
    color: var(--accent-cyan);
    animation: speakPulse 1.2s infinite ease-in-out;
}

@keyframes speakPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Premium Paywall Gold Card */
.paywall-gold-card {
    background: linear-gradient(135deg, #0b0d19 0%, #1e1338 50%, #78350f 100%);
    border: 2px solid #fbbf24;
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin: 20px auto;
    max-width: 480px;
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
    line-height: 1.5;
}

.paywall-gold-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.08) 50%, transparent 55%);
    animation: goldShine 6s infinite linear;
    pointer-events: none;
}

@keyframes goldShine {
    0% { transform: translate(-30%, -30%) rotate(0deg); }
    100% { transform: translate(30%, 30%) rotate(0deg); }
}

.paywall-crown {
    font-size: 2.5rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 8px #fbbf24);
}

.paywall-title {
    font-weight: 800;
    font-size: 1.35rem;
    color: #fbbf24;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.paywall-desc {
    font-size: 0.88rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.paywall-features {
    text-align: left;
    font-size: 0.85rem;
    margin: 14px 0;
    padding-left: 10px;
}

.paywall-feature-item {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.yape-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1px dashed rgba(251, 191, 36, 0.4);
    padding: 14px;
    border-radius: 12px;
    margin: 16px 0;
}

.yape-label {
    font-size: 0.78rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.yape-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: #00d2ff;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.paywall-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: #060913;
    font-weight: 700;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
    width: 100%;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.paywall-btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.5);
}

/* Yape Plan Selector Cards */
.yape-plan-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.yape-plan-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}

.yape-plan-card.selected {
    background: rgba(0,210,255,0.08);
    border-color: rgba(0,210,255,0.5);
    box-shadow: 0 0 16px rgba(0,210,255,0.12);
}

.yape-plan-card.selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent-cyan);
}

/* Payment status badges */
.payment-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-badge.pending {
    background: rgba(245,158,11,0.15);
    color: #f59e0b;
    border: 1px solid rgba(245,158,11,0.35);
}

.payment-badge.approved {
    background: rgba(34,197,94,0.15);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.35);
}

.payment-badge.rejected {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.35);
}

/* Admin tab active button */
.admin-tab-active {
    background: rgba(0,210,255,0.12) !important;
    border-color: rgba(0,210,255,0.4) !important;
    color: var(--accent-cyan) !important;
}

/* ==========================================================================
   Specialized Agents (Sidebar Cards)
   ========================================================================== */
.agents-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px;
    margin-top: 4px;
}

.agent-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    background: rgba(255,255,255,0.015);
    position: relative;
    overflow: hidden;
}

.agent-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.agent-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
    transform: translateX(3px);
}

.agent-card.active {
    background: rgba(0,210,255,0.06);
    border-color: rgba(0,210,255,0.25);
    box-shadow: 0 0 20px rgba(0,210,255,0.08), inset 0 0 20px rgba(0,210,255,0.03);
}

.agent-card.active::before {
    opacity: 1;
    background: linear-gradient(90deg, rgba(0,210,255,0.05) 0%, transparent 100%);
}

.agent-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: transform var(--transition-fast);
}

.agent-card:hover .agent-icon {
    transform: scale(1.08);
}

.agent-card.active .agent-icon {
    box-shadow: 0 2px 12px rgba(0,210,255,0.3);
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.agent-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-card.active .agent-name {
    color: var(--accent-cyan);
}

.agent-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Header Agent Indicator */
.agent-indicator {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0,210,255,0.08);
    border: 1px solid rgba(0,210,255,0.2);
    color: var(--accent-cyan);
    margin-left: 8px;
    letter-spacing: 0.3px;
    transition: all var(--transition-smooth);
    animation: agentPulse 2s ease-in-out infinite;
}

@keyframes agentPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,210,255,0.15); }
    50% { box-shadow: 0 0 12px 2px rgba(0,210,255,0.1); }
}

/* Mic recording animation */
#mic-btn.recording {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
    animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 16px 4px rgba(239, 68, 68, 0.2); }
}

/* KaTeX Math Formulas in Chat */
.message-bubble .katex {
    font-size: 1.05em;
    color: var(--accent-cyan);
}

.message-bubble .katex-display {
    margin: 12px 0;
    padding: 12px 16px;
    background: rgba(0, 210, 255, 0.03);
    border: 1px solid rgba(0, 210, 255, 0.1);
    border-radius: 10px;
    overflow-x: auto;
}

.message-bubble .katex-display > .katex {
    font-size: 1.15em;
}

/* ==========================================================================
   CRAZY UI FEATURES: Zen Mode & Artifact Panel
   ========================================================================== */

/* --- Artifact Panel (Split Screen) --- */
.artifact-panel {
    width: 0;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: var(--glass-blur);
    border-left: 1px solid rgba(0, 210, 255, 0.15);
    transition: width var(--transition-smooth);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.artifact-panel.open {
    width: 50vw;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.artifact-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.close-artifact-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-artifact-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.artifact-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.artifact-content .chart-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 60vh !important;
    margin: 0 !important;
}

/* --- Zen Mode (Cinematic Focus) --- */
body.zen-mode .sidebar {
    transform: translateX(-100%);
    position: absolute;
}

body.zen-mode .main-content {
    margin-left: 0;
    width: 100vw;
}

body.zen-mode .bg-gradient-mesh {
    animation: zenBreathing 8s infinite alternate ease-in-out;
    opacity: 0.85;
}

body.zen-mode .chat-input-form {

/* ==========================================================================
   CRAZY UI FEATURES: Zen Mode & Artifact Panel
   ========================================================================== */

/* --- Artifact Panel (Split Screen) --- */
.artifact-panel {
    width: 0;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: var(--glass-blur);
    border-left: 1px solid rgba(0, 210, 255, 0.15);
    transition: width var(--transition-smooth);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.artifact-panel.open {
    width: 50vw;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.artifact-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.close-artifact-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-artifact-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.artifact-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.artifact-content .chart-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 60vh !important;
    margin: 0 !important;
}

/* --- Zen Mode (Cinematic Focus) --- */
body.zen-mode .sidebar {
    transform: translateX(-100%);
    position: absolute;
}

body.zen-mode .main-content {
    margin-left: 0;
    width: 100vw;
}

body.zen-mode .bg-gradient-mesh {
    animation: zenBreathing 8s infinite alternate ease-in-out;
    opacity: 0.85;
}

body.zen-mode .chat-input-form {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(0, 210, 255, 0.4);
    box-shadow: 0 12px 50px rgba(0, 210, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

@keyframes zenBreathing {
    0% { filter: hue-rotate(0deg) brightness(0.8) blur(10px); transform: scale(1); }
    100% { filter: hue-rotate(20deg) brightness(1.3) blur(25px); transform: scale(1.05); }
}

/* ==========================================================================
   Premium Lightbox & Grid Overrides
   ========================================================================== */
.yape-grid {
    display: grid;
    gap: 10px;
}

@media (min-width: 769px) {
    .yape-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* Image Lightbox System */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 13, 0.95);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 40px rgba(0, 210, 255, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-overlay.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 3rem;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    user-select: none;
}

.lightbox-close:hover {
    transform: scale(1.1);
    color: #00d2ff;
}

.lightbox-caption {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    max-width: 80%;
    font-family: 'Outfit', sans-serif;
}
