:root {
    /* Colors - Deep Space & Neon (Default Dark) */
    --bg-deep: #050511;
    --bg-panel: rgba(20, 20, 35, 0.6);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.08);

    --primary-main: #a855f7;
    /* Purple */
    --primary-glow: #bfdbfe;
    /* Cool Blue */
    --accent-cyan: #06b6d4;
    /* Cyan */

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    /* Effects */
    --blur-panel: 20px;
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

    /* Animation */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Light Theme Overrides */
/* Light Theme Overrides - FIXED */
[data-theme="light"] {
    --bg-deep: #f8fafc;
    --bg-panel: rgba(255, 255, 255, 0.9); /* More opaque */
    --bg-glass: rgba(0, 0, 0, 0.05); /* Darker tint for visibility on white */
    --border-glass: rgba(0, 0, 0, 0.1);

    --primary-main: #7c3aed;
    --primary-glow: #60a5fa;
    --accent-cyan: #0891b2;

    --text-main: #0f172a; /* Darker Slate */
    --text-muted: #475569;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

/* Voice Overlay */
.voice-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1a1a2e, #000);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.voice-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.voice-status {
    margin-top: 40px;
    font-size: 24px;
    color: rgba(255,255,255,0.7);
    font-weight: 300;
}

.close-voice-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow: hidden;
    /* App feel */
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Living Background --- */
.background-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: -1;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-main), transparent);
    top: -20%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-cyan), transparent);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #db2777, transparent);
    /* Pinkish */
    top: 40%;
    left: 40%;
    opacity: 0.2;
    animation: float 25s infinite reverse ease-in-out;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    33% {
        transform: translate(30px, -50px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

/* --- App Container --- */
.app-container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    background: var(--bg-panel);
    backdrop-filter: blur(var(--blur-panel));
    -webkit-backdrop-filter: blur(var(--blur-panel));
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    overflow: hidden;
    position: relative;
    animation: fadeScaleIn 0.8s var(--ease-out);
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: width 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding: 0 10px;
}

.logo-orb {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-main), var(--accent-cyan));
    border-radius: 50%;
    box-shadow: 0 0 15px var(--primary-main);
}

.logo-text {
    font-weight: 600;
    font-size: 20px;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover,
.nav-item.active {
    background: var(--bg-glass);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.divider {
    height: 1px;
    background: var(--border-glass);
    margin: 15px 0;
}

.sidebar-bottom {
    margin-top: auto;
}

/* --- Chat Area --- */
.chat-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    height: 70px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 25px;
}

.model-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-glass);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
    font-size: 13px;
    color: var(--primary-glow);
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.greeting {
    font-size: 42px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 40px;
    width: 100%;
    max-width: 600px;
}

.suggestion-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Messages */
.message {
    max-width: 80%;
    animation: slideUp 0.3s var(--ease-out);
    line-height: 1.6;
}

.message.user {
    align-self: flex-end;
}

.message.ai {
    align-self: flex-start;
}

.message-bubble {
    padding: 15px 20px;
    border-radius: 18px;
    font-size: 15px;
    position: relative;
    backdrop-filter: blur(4px);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.6), rgba(124, 58, 237, 0.4));
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: var(--bg-glass);
    border-radius: 20px;
    width: fit-content;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Input Area */
.input-area-wrapper {
    padding: 24px;
    background: linear-gradient(to top, rgba(5, 5, 17, 0.8), transparent);
}

.input-container {
    background: rgba(30, 30, 50, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 12px 18px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
}

.input-container:focus-within {
    border-color: rgba(168, 85, 247, 0.4);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    padding: 8px 0;
    outline: none;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.send-btn {
    background: var(--primary-main);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* Modals & Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: #141423;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.active .modal {
    transform: translateY(0);
}

.modal h2 {
    margin: 0 0 10px;
    font-weight: 500;
}

.modal p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px;
    border-radius: 10px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--primary-main);
}

.primary-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-main), #9333ea);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s;
}

.primary-btn:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .app-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .sidebar {
        position: absolute;
        left: -100%;
        height: 100%;
        z-index: 50;
        background: #0c0c16;
        width: 85%;
    }

    .sidebar.active {
        left: 0;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }
}