@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* PWA NATIVE FEEL OPTIMIZATIONS */
html,
body {
    overscroll-behavior-y: none;
    /* Prevents pull-to-refresh feel in standalone app */
    -webkit-tap-highlight-color: transparent;
    /* Removes blue flash on mobile taps */
    -webkit-touch-callout: none;
    /* Prevents long-press context menu on images/links */
    user-select: text;
    /* Allow text selection in chat but... */
}

/* Disable selection for UI elements to feel native */
.nav-btn,
.header-new-chat-btn,
.send-btn-new,
.chip,
.icon-btn-small,
.logo-section {
    user-select: none;
    -webkit-user-drag: none;
}

:root {
    --bg-gradient: linear-gradient(135deg, #f5f0ff 0%, #eef2ff 100%);
    --header-gradient: linear-gradient(90deg, #ff9a9e 0%, #a18cd1 50%, #4facfe 100%);
    /* Vivid Pink -> Purple -> Blue */
    --text-primary: #333333;
    --text-secondary: #666666;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --shadow-soft: 0 8px 32px rgba(31, 38, 135, 0.1);
    --border-light: rgba(255, 255, 255, 0.4);
    --primary-blue: #007bff;

    /* Chip Colors - Darker/Richer for all themes */
    --chip-orange: #ffcc80;
    /* Darker pastel orange */
    --chip-yellow: #fff176;
    /* Darker pastel yellow */
    --chip-blue: #90caf9;
    /* Darker pastel blue */
    --chip-green: #a5d6a7;
    /* Darker pastel green */
}

/* --- ACCENT COLORS --- */
body.turbo-wine {
    --primary-blue: #be123c;
    /* Wine Red */
    --header-gradient: linear-gradient(90deg, #fb7185 0%, #e11d48 50%, #9f1239 100%);
}

/* Turbo Wine - Light Mode Bubbles */
body.turbo-wine .bg-bubbles {
    background-color: #fff1f2;
    /* Light rose background */
}

body.turbo-wine .bubble-1 {
    background: #fda4af;
}

body.turbo-wine .bubble-2 {
    background: #fb7185;
}

body.turbo-wine .bubble-3 {
    background: #f43f5e;
    opacity: 0.3;
}

body.turbo-wine .bubble-4 {
    background: #be123c;
    opacity: 0.4;
}

/* Turbo Wine - Dark Mode Bubbles */
body.dark-theme.turbo-wine .bg-bubbles {
    background-color: #2e020f;
    /* Deep wine background */
}

body.dark-theme.turbo-wine .bubble-1 {
    background: #4c0519;
}

body.dark-theme.turbo-wine .bubble-2 {
    background: #881337;
}

body.dark-theme.turbo-wine .bubble-3 {
    background: #9f1239;
    opacity: 0.2;
}

body.dark-theme.turbo-wine .bubble-4 {
    background: #e11d48;
    opacity: 0.15;
}

/* EchoSphere - The Futuristic Midnight Atmosphere (OFFICIAL SCREENSHOT MATCH) */
body.echo-sphere {
    --primary-blue: #a78bfa;
    /* Violet accent from reference */
    --header-gradient: linear-gradient(90deg, #7c3aed 0%, #db2713 0%, #db2777 100%);
    /* Violet to Pink match */
}

/* EchoSphere - Light Mode (Muted Slate) */
body.light-theme.echo-sphere .bg-bubbles {
    background-color: #f1f5f9;
}

body.light-theme.echo-sphere .bubble-1 {
    background: #cbd5e1;
}

body.light-theme.echo-sphere .bubble-2 {
    background: #e2e8f0;
}

/* EchoSphere - Dark Mode (VIBRANT PINK & INDIGO RECONSTRUCTION) */
body.dark-theme.echo-sphere .bg-bubbles {
    background-color: #0d0e21 !important;
    /* Deeper Indigo background */
    background-image: none !important;
    /* Clear the static gradients to let bubbles shine */
}

body.dark-theme.echo-sphere .bubble {
    display: block !important;
    /* Bubbles are back! */
    filter: blur(120px) !important;
    opacity: 0.6 !important;
}

body.dark-theme.echo-sphere .bubble-1 {
    background: radial-gradient(circle, #6366f1 0%, transparent 70%) !important;
    /* Vibrant Indigo Glow */
    width: 90vw;
    height: 90vw;
    top: -25vw;
    left: -20vw;
}

body.dark-theme.echo-sphere .bubble-2 {
    background: radial-gradient(circle, #db2777 0%, transparent 70%) !important;
    /* VIBRANT PINK GLOW */
    width: 70vw;
    height: 70vw;
    bottom: -15vw;
    right: -10vw;
}

body.dark-theme.echo-sphere .bubble-3 {
    background: radial-gradient(circle, #7c3aed 0%, transparent 70%) !important;
    /* Violet Glow */
    width: 60vw;
    height: 60vw;
    top: 30%;
    right: -25vw;
    opacity: 0.5 !important;
}

body.dark-theme.echo-sphere .bubble-4 {
    background: radial-gradient(circle, #f43f5e 0%, transparent 70%) !important;
    /* Pinkish-Red hint like reference */
    width: 50vw;
    height: 50vw;
    top: 15%;
    left: 20%;
    opacity: 0.4 !important;
    display: block !important;
}

/* UI Component Glassmorphism - Refined for EchoSphere */
body.echo-sphere .main-header {
    background: rgba(13, 15, 33, 0.55) !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.echo-sphere .speech-bubble {
    background: rgba(25, 27, 48, 0.6) !important;
    backdrop-filter: blur(30px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
}

body.echo-sphere .input-box-wrapper {
    background: rgba(15, 17, 33, 0.75) !important;
    backdrop-filter: blur(40px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.echo-sphere .chip {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Force chips to match the screenshot's 'Clean' look */
body.echo-sphere .chip-orange,
body.echo-sphere .chip-yellow,
body.echo-sphere .chip-blue,
body.echo-sphere .chip-green {
    border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.echo-sphere .header-new-chat-btn,
body.echo-sphere .send-btn-new {
    background: linear-gradient(135deg, #7c3aed, #db2777) !important;
    box-shadow: 0 4px 20px rgba(219, 39, 119, 0.4) !important;
    border: none !important;
}

body.echo-sphere .input-field {
    color: #ffffff !important;
}

body.echo-sphere .input-field:empty::before {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Classic Blue fallback is default --primary-blue */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
html {
    font-family: 'Outfit', sans-serif;
    background: transparent;
    /* Bubbles container will handle background */
    color: var(--text-primary);
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    /* Smooth scrolling only for chat-area */
    -webkit-overflow-scrolling: touch;
}



/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Background Bubbles Styling */
.bg-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -100;
    /* Deep background */
    overflow: hidden;
    background-color: #f8faff;
    /* Light theme bg */
}

body.dark-theme .bg-bubbles {
    background-color: #0f172a;
    /* Dark theme bg */
}

.bubble {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    pointer-events: none;
    animation: float 20s infinite alternate ease-in-out;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 40px) scale(1.1);
    }
}

.bubble-1 {
    width: 500px;
    height: 500px;
    background: #fbc2eb;
    /* Soft Pink */
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.bubble-2 {
    width: 600px;
    height: 600px;
    background: #a18cd1;
    /* Soft Purple */
    top: -150px;
    right: -100px;
    animation-delay: -5s;
}

.bubble-3 {
    width: 550px;
    height: 550px;
    background: #84fab0;
    /* Soft Green tint */
    bottom: -150px;
    left: 10%;
    opacity: 0.3;
    animation-delay: -10s;
}

.bubble-4 {
    width: 700px;
    height: 700px;
    background: #4facfe;
    /* Soft Blue */
    bottom: -200px;
    right: 10%;
    opacity: 0.4;
    animation-delay: -15s;
}

/* Dark Theme Bubbles */
body.dark-theme .bubble-1 {
    background: #312e81;
}

body.dark-theme .bubble-2 {
    background: #4c1d95;
}

body.dark-theme .bubble-3 {
    background: #064e3b;
    opacity: 0.2;
}

body.dark-theme .bubble-4 {
    background: #1e3a8a;
    opacity: 0.3;
}

/* Header */
.main-header {
    height: 75px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    padding-top: env(safe-area-inset-top, 0);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    width: 100% !important;
    position: relative !important;
    height: calc(75px + env(safe-area-inset-top, 0));
}

.app-container {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh;
    background: transparent;
    width: 100% !important;
}


.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-logo {
    height: 44px;
    width: 44px;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.app-name {
    color: #444;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.top-nav {
    display: flex;
    gap: 35px;
}

.nav-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    padding: 8px 0;
    transition: color 0.3s;
}

.nav-btn:hover {
    color: #000;
}

.nav-btn.active {
    color: #000;
    font-weight: 700;
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -22px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--header-gradient);
    border-radius: 4px;
}

.user-section .user-profile-icon {
    color: white;
    font-size: 32px;
    cursor: pointer;
    opacity: 0.9;
    display: flex;
    align-items: center;
}

.user-profile-icon .material-icons-outlined {
    font-size: 32px;
}

.header-new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-blue);
    border: none;
    padding: 8px 18px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.header-new-chat-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

.header-new-chat-btn .material-icons-outlined {
    font-size: 20px;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.chat-area {
    flex-grow: 1;
    padding: 10px 20px;
    /* Reduced vertical padding */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hero / Welcome */
.welcome-screen {
    width: 100%;
    max-width: 900px;
    margin-top: 0;
    /* No top margin */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    /* Tight gap between hero and suggestions */
}

.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    /* ZERO gap between character and bubble */
}

.character-container {
    width: 320px;
    /* Smaller character to help fit */
    height: auto;
    line-height: 0;
    /* Remove descender space */
    margin: 0;
}

.character-img {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: -25px;
    /* Pull the bubble UP onto the character more */
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
}

.speech-bubble {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    padding: 15px 30px;
    /* Tighter padding */
    border-radius: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    font-size: 20px;
    /* Slightly smaller text */
    font-weight: 500;
    color: #444;
    position: relative;
    max-width: 450px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin: 0;
}

.speech-bubble::before {
    display: none;
    /* Removing the triangle for a cleaner "modern bubble" look */
}

.suggestion-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    width: 100%;
}

/* Chips */
.chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.chip:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9) !important;
}

.chip-orange {
    border-left: 4px solid var(--chip-orange) !important;
}

.chip-yellow {
    border-left: 4px solid var(--chip-yellow) !important;
}

.chip-blue {
    border-left: 4px solid var(--chip-blue) !important;
}

.chip-green {
    border-left: 4px solid var(--chip-green) !important;
}

/* Input Area */
.input-area-container {
    padding: 20px;
    width: 100%;
}

.input-box-wrapper {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.08);
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.input-box-wrapper:focus-within {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.input-toolbar {
    background: rgba(255, 255, 255, 0.4);
    padding: 12px 20px;
    display: flex;
    gap: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.format-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #444;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.format-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

.input-field {
    padding: 16px 20px;
    min-height: 50px;
    max-height: 400px;
    overflow-y: auto;
    outline: none;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    transition: height 0.2s ease;
}

.input-field:empty::before {
    content: attr(placeholder);
    color: #aaa;
    pointer-events: none;
}

.input-footer {
    padding: 8px 16px 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-actions {
    display: flex;
    gap: 8px;
}

.icon-btn-small {
    background: #f1f3f4;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    transition: all 0.2s ease;
}

.icon-btn-small.recording {
    background: #fee2e2;
    color: #ef4444;
    animation: pulseMic 1.5s infinite;
}

@keyframes pulseMic {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.send-btn-new {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.send-btn-new:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

.send-btn-new:active {
    transform: translateY(0);
}

.disclaimer {
    text-align: center;
    font-size: 11px;
    color: #888;
    margin-top: 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
}

.disclaimer a,
.disclaimer a:visited,
.disclaimer a:hover,
.disclaimer a:active {
    color: #888 !important;
    text-decoration: none;
}

.disclaimer a:hover {
    text-decoration: underline;
}

/* Message Styling */
.message-container {
    width: 100%;
    max-width: 800px;
    /* Constrain message width */
    margin: 16px auto;
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

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

.ai-message {
    justify-content: flex-start;
}

.message-content {
    background: white;
    padding: 16px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    font-size: 15px;
    line-height: 1.6;
    max-width: 85%;
    /* Prevent stretching too far */
    word-break: break-word;
    overflow-wrap: break-word;
}

.user-message .message-content {
    background: var(--primary-blue);
    color: white;
    border-radius: 12px 12px 0 12px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.ai-message .message-content {
    background: white;
    border-radius: 12px 12px 12px 0;
    border: 1px solid #eee;
    position: relative;
}

/* --- MESSAGE ACTIONS --- */
.msg-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: opacity 0.2s;
}

body.dark-theme .msg-actions {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.message-container:hover .msg-actions {
    opacity: 1;
}



.user-actions {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
    border-color: transparent !important;
    opacity: 0.6;
    /* Half visible always for easier edit? No, keep hover. */
}

/* Ensure actions don't disappear if bubbles are too small */
.msg-actions button {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}


.user-actions button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* --- TYPING INDICATOR --- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Modals - SLEEK DARK LOOK FROM IMAGE */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    z-index: 999;
}

.modal {
    background: #212121;
    /* Dark grey backdrop from user image */
    color: #ececec;
    padding: 20px;
    border-radius: 16px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 85vh;
    overflow-y: auto;
    /* Custom Scrollbar for modal */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.modal h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ececec;
}

.activity-list {
    display: flex;
    flex-direction: column;
}

/* Activity Item - RECENT TAB STYLE */
.activity-item {
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.activity-item:hover {
    background: #333333;
    /* Darker hover from image */
}

.activity-item .title {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-item .date {
    font-size: 11px;
    color: #8e8e8e;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.close-modal-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ececec;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Settings Specific */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #aeaeae;
}

.styled-select {
    width: 100%;
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 10px;
    border-radius: 8px;
}

.danger-btn.full-width {
    width: 100%;
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
}

/* --- Toggle Switch --- */
.theme-toggle-container {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

input:checked+.slider {
    background-color: #2196F3;
}

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

.slider .material-icons-outlined {
    font-size: 16px;
    color: white;
}

/* Dark Theme Global Overrides */
body.dark-theme {
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

body.dark-theme .main-header {
    background: rgba(15, 23, 42, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .app-name,
body.dark-theme .nav-btn {
    color: #cbd5e1;
}

body.dark-theme .nav-btn:hover,
body.dark-theme .nav-btn.active {
    color: #fff;
}

body.dark-theme .speech-bubble {
    background: rgba(30, 41, 59, 0.7);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .chip {
    background: rgba(30, 41, 59, 0.5) !important;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .input-box-wrapper {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .input-toolbar {
    background: rgba(0, 0, 0, 0.2);
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .header-new-chat-btn {
    background: var(--primary-blue);
    color: white;
    border: none;
}

body.dark-theme .header-new-chat-btn:hover {
    background: #0056b3;
}

body.dark-theme .input-field {
    color: #ffffff !important;
}

body.dark-theme .input-field:empty::before {
    color: #888 !important;
}

.modal-actions,
.modal-footer {
    display: flex;
    justify-content: flex-start;
    margin-top: 25px;
}

.close-modal-btn {
    background: transparent;
    border: 1px solid #444;
    color: #ececec;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #666;
}

/* Fix AI Response Text Color - Force readability on white bubbles */
.ai-message .message-content,
body.dark-theme .ai-message .message-content {
    color: #333 !important;
}

/* Base text elements get the dark text, but leave complex components alone */
.ai-message .message-content p,
.ai-message .message-content li,
.ai-message .message-content h1,
.ai-message .message-content h2,
.ai-message .message-content h3,
.ai-message .message-content h4,
.ai-message .message-content strong,
.ai-message .message-content em,
.ai-message .message-content b,
.ai-message .message-content i {
    color: #333;
}

/* AI Lab - Exact Settings Style */
.tools-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.tool-btn {
    width: 100%;
    background-color: #333;
    color: #fff;
    border: 1px solid #444;
    padding: 14px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.tool-btn:hover {
    background-color: #404040;
    border-color: #555;
    transform: translateX(5px);
}

.tool-btn .material-icons-outlined {
    font-size: 20px;
    color: var(--primary-blue);
}

.tool-btn .btn-text {
    flex: 1;
}

.tool-btn .btn-desc {
    font-size: 11px;
    color: #888;
    margin-left: auto;
}

.styled-input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #444;
    background: #333;
    color: #fff;
    font-family: inherit;
    margin-top: 8px;
}

body.dark-theme .modal {
    background: #181818;
}

body.dark-theme .tool-card {
    background: #212121;
}

/* --- LOGIN SCREEN (ViViDly Secure - Inspiration Build V55) --- */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0b10;
    z-index: 5000;
    overflow: hidden;
}

.login-radial-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(37, 99, 235, 0.05) 50%, rgba(37, 99, 235, 0.1) 100%);
    pointer-events: none;
}

.login-card {
    background: rgba(21, 25, 33, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
    color: white;
    position: relative;
    z-index: 10;
    transition: transform 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
}

.login-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    margin: 0 auto 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.login-logo img {
    width: 100%;
    height: auto;
}

.login-card h2 {
    font-size: 26px;
    margin-bottom: 30px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.auth-form {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.input-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.input-header label {
    margin-bottom: 0;
}

.input-group label {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 8px;
}

.forgot-link {
    font-size: 12px;
    color: #4facfe;
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: #007bff;
}

.auth-input {
    background: rgba(11, 14, 20, 0.8);
    border: 1px solid #2a2e35;
    border-radius: 12px;
    padding: 14px 16px;
    color: white;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}

.auth-input:focus {
    border-color: #9333ea;
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.3);
}

.auth-submit-btn {
    background: linear-gradient(to right, #2563eb, #9333ea, #f97316);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-submit-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
    box-shadow: 0 10px 25px rgba(147, 51, 234, 0.4);
}

.auth-submit-btn:active {
    transform: scale(0.98);
}

.divider {
    display: flex;
    align-items: center;
    margin: 30px 0;
    color: #475569;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.divider span {
    padding: 0 15px;
}

.social-login-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.social-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    color: #fff;
    transition: all 0.2s;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.social-btn img {
    height: 22px;
}

.auth-footer {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 35px;
}

.auth-footer a {
    color: #4facfe;
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
}

/* --- Login Internal Modals --- */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 6000;
    padding: 20px;
}

.login-modal {
    background: #151921;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    padding: 40px;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.login-modal.active {
    transform: scale(1);
    opacity: 1;
}

.modal-close-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #888;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
}

.login-modal h3 {
    margin-top: 0;
    font-size: 24px;
    margin-bottom: 20px;
}

.modal-body-content p {
    color: #cbd5e1;
    line-height: 1.6;
    margin-bottom: 12px;
}

/* Hide app content when not logged in */
.app-container.gated {
    display: none !important;
}

.stealth-btn {
    background: rgba(0, 0, 0, 0.45) !important;
    color: #ff4d4d !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stealth-btn:hover {
    background: rgba(255, 59, 59, 0.1) !important;
    border-color: rgba(255, 59, 59, 0.3) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 59, 59, 0.1);
}

/* --- USER PROFILE & ACCOUNT MODAL --- */
.user-profile-section {
    margin-left: 15px;
}

.user-profile-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-profile-btn:hover {
    transform: scale(1.1);
    border-color: #4facfe;
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.3);
}

.user-profile-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.account-modal-content {
    max-width: 380px;
    text-align: center;
}

.account-header {
    padding: 10px 0 25px 0;
}

.account-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    margin: 0 auto 15px auto;
    padding: 3px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.account-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #111;
}

.account-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.account-header p {
    color: #888;
    font-size: 14px;
    margin-top: 5px;
}

/* ============================================================
   SUBSCRIPTION STATUS CARD IN ACCOUNT MODAL 
   ============================================================ */
.sub-status-card {
    background: linear-gradient(135deg, rgba(249, 171, 0, 0.08), rgba(138, 180, 248, 0.08));
    border: 1px solid rgba(249, 171, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}

.sub-status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #ececec;
}

.sub-status-details {
    margin-bottom: 12px;
}

.sub-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.sub-label {
    color: #9aa0a6;
}

.sub-value {
    color: #e8eaed;
    font-weight: 500;
}

.sub-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.sub-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #f9ab00);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.upgrade-btn-sm {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #f9ab00, #ff6b35);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.upgrade-btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(249, 171, 0, 0.4);
}

/* ============================================================
   PAYWALL OVERLAY
   ============================================================ */
.paywall-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.paywall-card {
    background: #1e1e2e;
    border: 1px solid rgba(249, 171, 0, 0.3);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.paywall-icon {
    margin-bottom: 16px;
}

.paywall-card h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #fff;
}

.paywall-card p {
    color: #9aa0a6;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.paywall-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
}

.pw-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pw-stat span:first-child {
    font-size: 28px;
    font-weight: 700;
    color: #f9ab00;
}

.pw-stat span:last-child {
    font-size: 11px;
    color: #9aa0a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.paywall-upgrade-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #f9ab00, #ff6b35);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.paywall-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(249, 171, 0, 0.4);
}

.paywall-footer {
    font-size: 12px !important;
    color: #666 !important;
}

/* ============================================================
   SUBSCRIPTION MODAL — FULL SaaS PRICING PAGE
   ============================================================ */
.subscription-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 10000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.sub-modal-content {
    max-width: 1100px;
    width: 95%;
    margin: 40px auto;
    padding: 0 20px 40px;
    position: relative;
}

.sub-close-btn {
    position: fixed;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.2s;
}

.sub-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Header */
.sub-header {
    text-align: center;
    padding: 40px 0 32px;
    color: white;
}

.sub-header h2 {
    font-size: 36px;
    font-weight: 700;
    margin: 16px 0 8px;
    background: linear-gradient(135deg, #fff, #8ab4f8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sub-header p {
    color: #9aa0a6;
    font-size: 16px;
    max-width: 500px;
    margin: 0 auto 24px;
}

/* Billing Toggle */
.billing-toggle {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.billing-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: #9aa0a6;
    background: transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.billing-btn.active {
    background: rgba(138, 180, 248, 0.2);
    color: #8ab4f8;
}

.save-badge {
    background: #4ade80;
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Pricing Grid */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

/* Price Card */
.price-card {
    background: rgba(30, 30, 46, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 28px 24px;
    position: relative;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.price-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

/* Card Ribbons */
.card-ribbon {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.card-ribbon.free {
    background: rgba(138, 180, 248, 0.2);
    color: #8ab4f8;
}

.card-ribbon.popular {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.card-ribbon.best {
    background: rgba(168, 139, 252, 0.2);
    color: #a88bfc;
}

.card-ribbon.enterprise {
    background: rgba(249, 171, 0, 0.2);
    color: #f9ab00;
}

/* Plan Cards Color Coding */
.price-card.trial {
    border-color: rgba(138, 180, 248, 0.2);
}

.price-card.trial:hover {
    border-color: rgba(138, 180, 248, 0.5);
    box-shadow: 0 16px 40px rgba(138, 180, 248, 0.1);
}

.price-card.starter {
    border-color: rgba(74, 222, 128, 0.2);
}

.price-card.starter:hover {
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: 0 16px 40px rgba(74, 222, 128, 0.1);
}

.price-card.pro {
    border-color: rgba(168, 139, 252, 0.4);
    background: linear-gradient(180deg, rgba(168, 139, 252, 0.08), rgba(30, 30, 46, 0.95));
    transform: scale(1.03);
}

.price-card.pro:hover {
    transform: scale(1.03) translateY(-4px);
    box-shadow: 0 20px 50px rgba(168, 139, 252, 0.2);
}

.price-card.ultra {
    border-color: rgba(249, 171, 0, 0.2);
}

.price-card.ultra:hover {
    border-color: rgba(249, 171, 0, 0.5);
    box-shadow: 0 16px 40px rgba(249, 171, 0, 0.1);
}

.price-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}

.price-card .price {
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.price-card .price span {
    font-size: 16px;
    font-weight: 400;
    color: #9aa0a6;
}

.price-period {
    font-size: 13px;
    color: #9aa0a6;
    margin-bottom: 20px;
}

/* Features */
.features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: #e8eaed;
}

.features li.disabled {
    color: #5f6368;
}

.feat-icon {
    font-size: 16px !important;
    color: #4ade80;
}

.features li.disabled .feat-icon {
    color: #5f6368;
}

/* Plan Buttons */
.plan-select-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: transparent;
    color: #e8eaed;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.plan-select-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
}

.plan-select-btn.current {
    background: rgba(138, 180, 248, 0.1);
    border-color: rgba(138, 180, 248, 0.3);
    color: #8ab4f8;
    cursor: default;
}

.plan-select-btn.featured {
    background: linear-gradient(135deg, #a88bfc, #8ab4f8);
    border: none;
    color: #fff;
}

.plan-select-btn.featured:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(168, 139, 252, 0.4);
}

.plan-id-tag {
    margin-top: 12px;
    font-size: 11px;
    color: #5f6368;
    font-family: monospace;
}

/* Trust Section */
.trust-section {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9aa0a6;
    font-size: 13px;
}

.trust-item .material-icons-outlined {
    font-size: 18px;
    color: #4ade80;
}

/* FAQ */
.sub-faq {
    max-width: 700px;
    margin: 0 auto 40px;
}

.sub-faq h4 {
    text-align: center;
    color: #fff;
    font-size: 20px;
    margin-bottom: 20px;
}

.faq-item {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    background: rgba(30, 30, 46, 0.6);
}

.faq-q {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    color: #e8eaed;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.faq-q:hover {
    background: rgba(255, 255, 255, 0.04);
}

.faq-q .material-icons-outlined {
    font-size: 20px;
    color: #9aa0a6;
    transition: transform 0.3s;
}

.faq-item.open .faq-q .material-icons-outlined {
    transform: rotate(180deg);
}

.faq-a {
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    color: #9aa0a6;
    font-size: 13px;
    line-height: 1.6;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-a {
    max-height: 200px;
    padding: 0 20px 16px;
}

.sub-footer-text {
    text-align: center;
    color: #5f6368;
    font-size: 13px;
}

.sub-footer-text a {
    color: #8ab4f8;
    text-decoration: none;
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.viv-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e2e;
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #4ade80;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ============================================================
   RESPONSIVE — PRICING
   ============================================================ */
@media (max-width: 900px) {
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .price-card.pro {
        transform: scale(1);
    }

    .price-card.pro:hover {
        transform: translateY(-4px);
    }
}

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

    .sub-header h2 {
        font-size: 28px;
    }

    .paywall-card {
        padding: 28px 20px;
    }

    .trust-section {
        gap: 16px;
    }
}


/* ============================================================
   MOBILE OPTIMIZATIONS - Unified Responsive Fixes
   ============================================================ */
@media screen and (max-width: 768px) {

    /* --- Main Header Adjustments --- */
    .main-header {
        height: auto !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        padding: 6px 12px !important;
        gap: 8px !important;
        justify-content: flex-start !important;
        align-items: center !important;
        display: flex !important;
        background: rgba(255, 255, 255, 0.6) !important;
        backdrop-filter: blur(20px) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        scrollbar-width: none !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .main-header::-webkit-scrollbar {
        display: none !important;
    }

    body.dark-theme .main-header {
        background: rgba(20, 20, 30, 0.9) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .logo-section {
        flex: 0 0 auto !important;
        width: auto !important;
        margin: 0 !important;
    }

    .app-logo {
        height: 28px !important;
        width: 28px !important;
        padding: 0 !important;
    }

    .app-name {
        display: none !important;
        /* Hide app name on narrow screens to save space */
    }


    /* Top Navigation bar - Inline with header now */
    .top-nav {
        order: unset !important;
        width: auto !important;
        flex: 0 0 auto !important;
        display: flex !important;
        flex-direction: row !important;
        white-space: nowrap !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 6px !important;
        border-top: none !important;
        background: transparent !important;
    }

    .top-nav::-webkit-scrollbar {
        display: none !important;
    }

    body.dark-theme .top-nav {
        border-top-color: rgba(255, 255, 255, 0.1) !important;
    }

    .nav-btn {
        flex: 0 0 auto !important;
        padding: 6px 12px !important;
        margin: 0 !important;
        font-size: 14px !important;
        background: rgba(0, 0, 0, 0.03) !important;
        border-radius: 12px !important;
    }

    body.dark-theme .nav-btn {
        background: rgba(255, 255, 255, 0.05) !important;
        color: #cbd5e1 !important;
    }

    body.dark-theme .nav-btn.active {
        color: #fff !important;
    }

    /* Right side controls grouped */
    .theme-toggle-container {
        margin: 0 !important;
        transform: scale(0.85) !important;
        display: flex !important;
        flex: 0 0 auto !important;
    }

    .user-profile-section {
        margin-left: 5px !important;
        order: 3 !important;
        flex: 0 0 auto !important;
    }

    .user-profile-btn {
        height: 28px !important;
        width: 28px !important;
    }

    .user-profile-btn img {
        height: 28px !important;
        width: 28px !important;
    }

    /* "New Chat" icon button */
    #header-new-chat-icon-btn,
    .header-new-chat-btn {
        display: flex !important;
        padding: 4px 8px !important;
        border-radius: 14px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        gap: 4px !important;
        margin-right: 5px !important;
        height: 28px !important;
        align-items: center !important;
        width: auto !important;
        background: #4facfe !important;
        color: white !important;
        white-space: nowrap !important;
    }

    #header-new-chat-icon-btn span {
        font-size: 13px !important;
        display: inline !important;
        margin: 0 !important;
    }

    #header-new-chat-icon-btn .material-icons-outlined {
        font-size: 18px !important;
    }

    /* --- Auth Pages Fix --- */
    .login-screen {
        padding: 20px !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
    }

    .login-card {
        padding: 30px 20px !important;
        margin: 20px auto 40px !important;
        min-height: auto !important;
    }

    .social-login-grid {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .auth-footer {
        margin-top: 20px !important;
        padding-bottom: 10px !important;
    }

    /* --- Suggestions & Chat Area Fix --- */
    .suggestion-cards {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        padding: 0 10px 80px !important;
        gap: 10px !important;
        flex-wrap: nowrap !important;
    }

    .chip {
        width: 100% !important;
        max-width: none !important;
        justify-content: center !important;
        padding: 15px 20px !important;
        margin: 0 !important;
    }

    /* --- Layout & Scrolling Fixes --- */
    body,
    html {
        height: 100dvh !important;
        /* Remove strict overflow: hidden which breaks mobile scrolling sometimes */
        overflow: auto !important;
        overflow-x: hidden !important;
    }

    .app-container {
        height: 100dvh !important;
        min-height: 100dvh !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .main-content {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .split-view-container,
    .chat-wrapper {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .chat-area {
        flex: 1 !important;
        overflow-y: auto !important;
        padding-bottom: 220px !important;
        /* More space for input footer */
        -webkit-overflow-scrolling: touch !important;
        /* Add padding at top to avoid clashing with header */
        padding-top: 20px !important;
    }

    /* --- Input Area Fixes --- */
    .input-area-container {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: none !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 10px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(15px) !important;
        border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-left: none !important;
        border-right: none !important;
        border-bottom: none !important;
        z-index: 1000 !important;
        margin: 0 !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
    }

    body.dark-theme .input-area-container {
        background: rgba(20, 20, 30, 0.98) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .input-box-wrapper {
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 12px !important;
        background: rgba(0, 0, 0, 0.03) !important;
    }

    body.dark-theme .input-box-wrapper {
        background: rgba(255, 255, 255, 0.05) !important;
    }

    .input-toolbar {
        padding: 8px 10px !important;
        gap: 15px !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        scrollbar-width: none !important;
        background: transparent !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    }

    .input-toolbar::-webkit-scrollbar {
        display: none !important;
    }

    body.dark-theme .input-toolbar {
        border-bottom-color: rgba(255, 255, 255, 0.05) !important;
    }

    .format-btn {
        padding: 10px !important;
        font-size: 18px !important;
    }

    body.dark-theme .format-btn {
        color: #ececec !important;
    }

    .input-footer {
        padding: 10px 10px 15px !important;
    }

    .left-actions {
        gap: 10px !important;
    }

    .icon-btn-small {
        width: 44px !important;
        height: 44px !important;
    }

    .send-btn-new {
        padding: 10px 18px !important;
        font-size: 15px !important;
    }

    .disclaimer {
        display: none !important;
    }

    /* Force text white logic on dark inputs */
    body.dark-theme .input-field {
        color: #ffffff !important;
        caret-color: #ffffff !important;
    }

    body.dark-theme .input-field:empty::before {
        color: rgba(255, 255, 255, 0.5) !important;
    }
}


/* File Preview */
.file-preview-area {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.file-chip {
    background: #e8f0fe;
    color: #1967d2;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.file-chip .file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.remove-file-btn {
    background: none;
    border: none;
    color: #1967d2;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

/* Dark Mode Support */
body.dark-theme .file-preview-area {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .file-chip {
    background: #3c4043;
    color: #a8c7fa;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .remove-file-btn {
    color: #a8c7fa;
}

/* --- CANVAS FEATURE --- */
.main-content {
    /* Constrain height for split view */
    height: calc(100vh - 75px);
    overflow: hidden;
}

.split-view-container {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.chat-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Allow shrinking */
    height: 100%;
    position: relative;
}

/* Ensure chat area scrolls correctly */
.chat-area {
    flex-grow: 1;
    overflow-y: auto;
    height: 0;
    /* Important for flex child scrolling */
    padding-bottom: 20px;
}

/* Canvas Panel */
.canvas-panel {
    width: 450px;
    height: 100%;
    background: #ffffff;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 20;
    transition: transform 0.3s ease;
    display: none;
}

.canvas-panel.active {
    display: flex;
}

.canvas-header {
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #f8fafc;
}

.canvas-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 8px;
}

.canvas-actions {
    display: flex;
    gap: 8px;
}

.canvas-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.canvas-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1e293b;
}

.canvas-body {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: #fff;
}

.canvas-editor {
    width: 100%;
    min-height: 100%;
    padding: 25px;
    border: none;
    outline: none;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
    box-sizing: border-box;
}

/* Dark Mode Canvas */
body.dark-theme .canvas-panel {
    background: #1e1e2e;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-theme .canvas-header {
    background: #181825;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .canvas-header h3 {
    color: #a6accd;
}

body.dark-theme .canvas-btn {
    color: #94a3b8;
}

body.dark-theme .canvas-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.dark-theme .canvas-body,
body.dark-theme .canvas-editor {
    background: #1e1e2e;
    color: #cdd6f4;
}

/* Mobile: Full Screen Canvas */
@media (max-width: 768px) {
    .canvas-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        /* On top of everything */
    }
}

/* --- CANVAS TABS & PREVIEW --- */
.canvas-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
    background: #f1f5f9;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    height: 40px;
}

.canvas-tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.canvas-tab-btn:hover {
    color: #334155;
    background: rgba(0, 0, 0, 0.03);
}

.canvas-tab-btn.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    background: white;
    /* Tab look? Or just underline? Let's use underline */
    background: transparent;
}

.canvas-body {
    display: flex;
    flex-direction: column;
}

.canvas-views {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #fff;
}

.canvas-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    overflow: auto;
}

.canvas-view.active {
    display: block;
}

/* Code View Styling */
.canvas-editor {
    border: none;
    width: 100%;
    height: 100%;
    resize: none;
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    background: #f8fafc;
    /* Subtle grey for code */
    outline: none;
}

/* Preview View Styling */
.canvas-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Dark Mode Adjustments */
body.dark-theme .canvas-tabs {
    background: #181825;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .canvas-tab-btn {
    color: #94a3b8;
}

body.dark-theme .canvas-tab-btn.active {
    color: #8ab4f8;
    border-bottom: 2px solid #8ab4f8;
}

body.dark-theme .canvas-editor {
    background: #1e1e2e;
    color: #cdd6f4;
}

body.dark-theme .canvas-preview-frame {
    background: #ffffff;
    /* Preview usually needs white bg unless specific dark mode css provided */
}

/* --- IMAGE PREVIEW STYLING --- */
.image-preview-chip {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    gap: 10px;
    margin-bottom: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.image-preview-chip img {
    height: 48px !important;
    width: 48px !important;
    min-width: 48px !important;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.image-preview-chip span {
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.image-preview-chip .remove-img-btn {
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #ef4444;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
    border-radius: 4px;
}

.image-preview-chip .remove-img-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Dark Mode Adjustments */
body.dark-theme .image-preview-chip {
    background: #1e1e2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .image-preview-chip span {
    color: #cbd5e1;
}

body.dark-theme .image-preview-chip img {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- TOAST NOTIFICATIONS --- */
.viv-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
    backdrop-filter: blur(10px);
    opacity: 0;
}

body.light-theme .viv-toast {
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

@keyframes slideUp {
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    to {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
}

/* --- VOICE VISUALIZER --- */
@keyframes pulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(248, 113, 113, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0);
    }
}

#mic-btn.active {
    animation: pulseRing 1.5s infinite;
    border-radius: 50%;
}

/* --- CODE SNIPPET STYLING --- */
.code-snippet-container {
    background: #282c34 !important;
    border-radius: 8px;
    margin: 10px 0;
    overflow: hidden;
    color: #abb2bf !important;
    font-size: 14px;
}

.code-snippet-container * {
    color: inherit;
}

.code-snippet-header {
    background: #1e2227 !important;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #181a1f;
}

.code-lang {
    font-family: monospace;
    color: #9cdcfe !important;
    font-size: 12px;
    text-transform: uppercase;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #8ab4f8 !important;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
}

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

.code-snippet-container pre {
    margin: 0;
    padding: 12px;
    overflow-x: auto;
}

.code-snippet-container pre code {
    color: #ffffff !important;
}

/* ============================================================
   PWA INSTALL OVERLAY — Premium Design
   ============================================================ */
.pwa-install-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 20px;
    font-family: 'Outfit', sans-serif;
}

.pwa-install-card {
    background: linear-gradient(145deg, rgba(30, 30, 60, 0.95), rgba(15, 15, 35, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 40px 30px 30px;
    max-width: 380px;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.pwa-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 80%, rgba(74, 222, 128, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 30% 20%, rgba(138, 180, 248, 0.06) 0%, transparent 50%);
    pointer-events: none;
    animation: pwaGlowPulse 4s ease-in-out infinite;
}

@keyframes pwaGlowPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.pwa-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(74, 222, 128, 0.4);
    box-shadow: 0 8px 30px rgba(74, 222, 128, 0.25);
    margin-bottom: 20px;
    position: relative;
    animation: pwaAvatarFloat 3s ease-in-out infinite;
}

@keyframes pwaAvatarFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.pwa-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px;
    background: linear-gradient(90deg, #4ade80, #8ab4f8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pwa-desc {
    font-size: 14px;
    color: #a0a8c0;
    margin: 0 0 24px;
    line-height: 1.6;
}

.pwa-features {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pwa-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    color: #cbd5e1;
}

.pwa-feature .material-icons-outlined {
    font-size: 16px;
    color: #4ade80;
}

.pwa-install-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 50%, #3b82f6 100%);
    color: #000;
    font-weight: 700;
    font-size: 16px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.3);
    margin-bottom: 16px;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(74, 222, 128, 0.45);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-ios-instructions {
    display: none;
    background: rgba(255, 255, 255, 0.04);
    padding: 18px 20px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
    text-align: left;
}

.pwa-ios-instructions ol {
    margin: 0;
    padding-left: 20px;
    color: #ddd;
    font-size: 14px;
    line-height: 2;
}

.pwa-ios-instructions li {
    margin-bottom: 4px;
}

.pwa-close-btn {
    background: none;
    border: none;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    margin-top: 12px;
    font-family: 'Outfit', sans-serif;
    transition: color 0.2s;
}

.pwa-close-btn:hover {
    color: #888;
}

.pwa-trust {
    font-size: 11px;
    color: #555;
    margin: 16px 0 0;
}

/* ============================================================
   EXTRA MOBILE OPTIMIZATIONS (Safe Areas + Touch + Small Screens)
   ============================================================ */

/* Safe area insets for notched phones (iPhone X+, Android punch-hole) */
@supports (padding: env(safe-area-inset-top)) {
    .pwa-install-overlay {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Very small screens (iPhone SE, small Android) */
@media screen and (max-width: 380px) {
    .pwa-install-card {
        padding: 30px 20px 24px;
        border-radius: 20px;
    }

    .pwa-avatar {
        width: 80px;
        height: 80px;
    }

    .pwa-title {
        font-size: 20px;
    }

    .pwa-features {
        flex-direction: column;
        align-items: center;
    }
}

/* Landscape mode on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .pwa-install-card {
        padding: 20px;
        max-height: 95vh;
        overflow-y: auto;
    }

    .pwa-avatar {
        width: 60px;
        height: 60px;
        margin-bottom: 10px;
    }

    .pwa-features {
        margin-bottom: 12px;
    }
}

/* PWA Standalone mode tweaks — when running as installed app */
@media all and (display-mode: standalone) {
    .pwa-install-overlay {
        display: none !important;
    }

    /* Full height in standalone */
    body,
    html {
        height: 100vh !important;
        height: 100dvh !important;
    }
}

/* ============================================================
   VI-VIDLY PREMIUM FEATURES (v55) - GOD-TIER OVERHAUL
   ============================================================ */

/* 1. Header Controls & Incognito Mode */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}





/* 3. File Previews */
.file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.file-preview-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    position: relative;
    animation: slideUp 0.3s ease;
}

.file-preview-card span.file-icon {
    color: var(--primary-blue);
    font-size: 20px;
}

.file-preview-card span.file-name {
    font-size: 12px;
    color: #eee;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3b30;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    border: none;
}

/* 4. Message Features (TTS, Charts) */
.speaker-icon {
    margin-left: 10px;
    font-size: 18px !important;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
    vertical-align: middle;
}

.speaker-icon:hover {
    color: var(--primary-blue);
    transform: scale(1.1);
}

.speaker-icon.speaking {
    color: #4ade80;
    animation: pulseSpeak 1s infinite;
}

@keyframes pulseSpeak {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

.viv-chart-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    margin: 15px 0;
    width: 100%;
    height: 300px;
}

/* 5. Prompt Library Button & Modal */
.sparkle-btn {
    background: linear-gradient(90deg, #7c3aed, #ec4899) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border: none !important;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px !important;
    border-radius: 10px !important;
}

.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.prompt-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.prompt-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-blue);
    transform: translateY(-3px);
}

.prompt-card h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #fff;
}

.prompt-card p {
    margin: 0;
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}



.toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 10px;
}

/* Slash Command Menu */
.slash-menu {
    position: absolute;
    bottom: 100%;
    left: 20px;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    overflow: hidden;
    z-index: 2000;
    display: none;
}

.slash-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.slash-item:hover,
.slash-item.active {
    background: rgba(0, 123, 255, 0.08);
}

.slash-item .cmd-name {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 14px;
}

.slash-item .cmd-desc {
    color: #888;
    font-size: 12px;
}

/* Model Switcher */
.model-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px;
    border-radius: 10px;
}

.model-option {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    white-space: nowrap;
}

.model-option.active {
    background: white;
    color: var(--primary-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Markdown Enhancements */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.message-content th,
.message-content td {
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    text-align: left;
}

.message-content th {
    background: rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

/* Dark Theme Overrides */
body.dark-theme .slash-menu {
    background: rgba(30, 30, 45, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .model-option.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body.dark-theme .message-content th {
    background: rgba(255, 255, 255, 0.05);
}