@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

/* --- THEME VARIABLES --- */
:root[data-theme="dark"] {
    --bg-main: #131314;
    --bg-sidebar: #1E1F20;
    --bg-input: #1E1F20;
    --text-main: #E3E3E3;
    --text-muted: #C4C7C5;
    --hover-color: #333537;
    --brand-gradient: linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%, #9b72cb 50%, #d96570 56%, #131314 75%, #131314 100%);
    --glass-bg: rgba(20, 20, 20, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-color: #E3E3E3;
    --placeholder-color: #C4C7C5;
}

:root[data-theme="light"] {
    --bg-main: #FFFFFF;
    --bg-sidebar: #F0F4F9;
    --bg-input: #F0F4F9;
    --text-main: #1F1F1F;
    --text-muted: #444746;
    --hover-color: #DFE4EA;
    --brand-gradient: linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%, #9b72cb 50%, #d96570 56%, #ffffff 75%, #ffffff 100%);
    --input-border: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* Eliminate default mobile browser blue tap highlight and prevent text selection on UI elements */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent !important;
}
button, a, .popup-item, .icon-btn, .action-menu-btn, .action-item, .theme-btn {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    user-select: none !important;
}

html {
    background: var(--bg-main);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

body {
    display: flex;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    overflow-x: hidden;
    width: 100%;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

/* ========================================= */
/* DYNAMIC AURORA BACKGROUND (Automatic Changing Graphics) */
/* ========================================= */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    /* Background me piche rahega */
    filter: blur(80px);
    /* Ekdum soft glow banayega */
    opacity: 0.5;
    /* Light me zyada dark na lage */
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    animation: moveBlobs 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 50vw;
    height: 50vw;
    background-color: #9b72cb;
    /* Purple */
    top: -20%;
    left: -10%;
    animation-delay: 0s;
}

.blob-2 {
    width: 40vw;
    height: 40vw;
    background-color: #4285f4;
    /* Blue */
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
    animation-direction: alternate-reverse;
}

.blob-3 {
    width: 45vw;
    height: 45vw;
    background-color: #d96570;
    /* Pink/Red */
    top: 30%;
    left: 40%;
    animation-delay: -10s;
}

/* Automatic Graphic Movement & Color Shift Keyframes */
@keyframes moveBlobs {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        filter: hue-rotate(0deg);
        /* Color change */
    }

    50% {
        transform: translate(10vw, 15vh) scale(1.2) rotate(180deg);
        filter: hue-rotate(90deg);
        /* Color change automatically */
    }

    100% {
        transform: translate(-15vw, -10vh) scale(0.9) rotate(360deg);
        filter: hue-rotate(180deg);
        /* Color change automatically */
    }
}

/* ========================================= */
/* SIDEBAR (Gemini Style) */
/* ========================================= */
.sidebar {
    width: 280px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 15px 10px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 76px;
}

/* Sidebar ke andar ke elements ki visibility fix */
.sidebar .text,
.sidebar .section-title,
.sidebar .recent-chats {
    transition: opacity 0.2s ease;
    opacity: 1;
}

.sidebar.collapsed .text,
.sidebar.collapsed .section-title,
.sidebar.collapsed .recent-chats,
.sidebar.collapsed .pinned-chats,
.sidebar.collapsed .search-section,
.sidebar.collapsed .media-options,
.sidebar.collapsed .video-sidebar,
.sidebar.collapsed .library-sidebar {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.video-sidebar {
    margin: 0 0 0 14px;
}

.pinned-chats {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    min-height: 0;
}

.pinned-chats>.section-title {
    flex-shrink: 0;
}

.pinned-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 115px;
    min-height: 0;
}

.pinned-scroll::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

.pinned-scroll::-webkit-scrollbar-track {
    display: none;
}

.pinned-scroll::-webkit-scrollbar-thumb {
    display: none;
}

.pin-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 6px 15px;
    border-radius: 50px;
    color: var(--text-main);
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
    position: relative;
}

.pin-item:hover {
    background-color: var(--hover-color);
    transform: translateX(4px);
}

.pin-item i:first-child {
    font-size: 12px;
    color: var(--text-muted);
    transform: rotate(45deg);
    flex-shrink: 0;
}

.pin-item .text {
    flex-grow: 1;
}

.pin-dots {
    opacity: 0;
    pointer-events: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.pin-dots i {
    font-size: 12px;
    color: var(--text-muted);
    transform: none !important;
}

.pin-item:hover .pin-dots {
    opacity: 1;
    pointer-events: auto;
}

.pin-dots:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pin-popup {
    position: fixed;
    background: rgba(30, 30, 40, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    border-radius: 14px;
    padding: 6px;
    min-width: 160px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-popup.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.pin-popup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 13px;
    transition: background 0.15s ease;
}

.pin-popup-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.pin-popup-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.pin-popup-item.delete {
    color: #ff4d4d;
}

[data-theme="light"] .pin-popup {
    background: rgba(240, 244, 249, 0.75);
}

[data-theme="light"] .pin-popup-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .pin-popup-item.delete {
    color: #d32f2f;
}

/* --- Timestamp Popup (right-click / long-press) --- */
.timestamp-popup {
    position: fixed;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(6px);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timestamp-popup.show {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}

.ts-popup-arrow {
    width: 10px;
    height: 10px;
    background: rgba(30, 31, 32, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-right: none;
    border-bottom: none;
    transform: rotate(45deg);
    margin-bottom: -6px;
    z-index: -1;
    border-radius: 2px 0 0 0;
}

.ts-popup-body {
    background: rgba(30, 31, 32, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

[data-theme="light"] .ts-popup-body {
    background: rgba(240, 244, 249, 0.9);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ts-popup-arrow {
    background: rgba(240, 244, 249, 0.9);
    border-color: rgba(0, 0, 0, 0.06);
}

.ts-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.ts-row i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.ts-row span {
    letter-spacing: 0.2px;
}

.ts-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 3px 0;
}

[data-theme="light"] .ts-divider {
    background: rgba(0, 0, 0, 0.06);
}

.ts-copy-row {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 0;
    transition: background 0.15s ease;
    color: var(--text-muted);
}

.ts-copy-row:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

[data-theme="light"] .ts-copy-row:hover {
    background: rgba(0, 0, 0, 0.04);
}

.ts-copy-row.copied i {
    color: #34a853;
}

.ts-copy-row.copied span {
    color: #34a853;
}

.pin-popup-item.delete i {
    color: #ff4d4d;
}

.library-sidebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px !important;
    margin: 0 0 0 14px;
    border-radius: 50px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: clamp(0.85rem, 1.5vw, 1.05rem) !important;
    font-weight: 500;
    transition: 0.2s;
}

.library-sidebar:hover {
    color: var(--text-main);
    transform: translateX(4px);
}

.library-sidebar i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.library-sidebar .text {
    font-size: 13px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.top-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar:not(.collapsed) .top-actions {
    align-items: flex-start;
}

.sidebar.collapsed .top-actions {
    align-items: center;
}

.sidebar:not(.collapsed) .brand-container {
    width: 100%;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

.icon-btn:hover {
    background-color: var(--hover-color);
}

.menu-btn:hover {
    background-color: transparent;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 14px !important;
    margin: 0 0 0 14px;
    border-radius: 50px;
    font-size: clamp(0.85rem, 1.5vw, 1.05rem) !important;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.sidebar.collapsed .brand-container {
    width: 100% !important;
    justify-content: center !important;
}

.sidebar.collapsed .menu-btn {
    width: 40px !important;
    height: 40px !important;
    margin: 0 auto !important;
}

.sidebar.collapsed .new-chat-btn {
    width: 40px !important;
    height: 40px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    gap: 0 !important;
    justify-content: center !important;
    align-items: center !important;
    background: transparent;
}



.new-chat-btn:hover {
    color: var(--text-main);
}

.new-chat-btn i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.new-chat-btn:hover i {
    animation: featherGlow 0.6s ease;
}

@keyframes featherGlow {
    0% {
        transform: rotate(0deg) scale(1);
        color: var(--text-muted);
    }

    30% {
        transform: rotate(-15deg) scale(1.2);
        color: #A064FF;
    }

    60% {
        transform: rotate(5deg) scale(1.1);
        color: #4285f4;
    }

    100% {
        transform: rotate(0deg) scale(1);
        color: var(--text-main);
    }
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Toggle button ko thoda aur animate kiya */
.menu-btn {
    transition: transform 0.3s ease, margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
}

.menu-btn:active {
    transform: scale(0.9);
}

.brand-text {
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(to right, var(--text-main, #fff), #d4a44a, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.3px;
    text-decoration: none;
}

.sidebar:not(.collapsed) .brand-text {
    opacity: 1;
    width: auto;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.brand-text:hover {
    opacity: 0.8;
}

.search-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px !important;
    margin: 0 0 0 14px;
    border-radius: 50px;
    background: transparent;
    transition: 0.2s;
    width: 100%;
}

.search-section:hover {
    transform: translateX(4px);
}

.search-icon {
    font-size: 14px;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: clamp(0.85rem, 1.5vw, 1.05rem) !important;
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--text-muted);
    font-size: clamp(0.85rem, 1.5vw, 1.05rem) !important;
}

.media-options {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 0 14px;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px !important;
    border-radius: 50px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: clamp(0.85rem, 1.5vw, 1.05rem) !important;
    font-weight: 500;
    transition: 0.2s;
}

.media-item:hover {
    color: var(--text-main);
    transform: translateX(4px);
}

.media-item i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    transition: opacity 0.25s ease;
}

.sidebar-bars-icon {
    position: absolute;
    font-size: 22px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.sidebar-bars-icon.flip {
    transform: rotate(180deg);
}

/* Restrict hover-swap strictly to mouse/trackpad devices */
@media (hover: hover) and (pointer: fine) {
    .menu-btn:hover .sidebar-logo {
        opacity: 0;
    }
    .menu-btn:hover .sidebar-bars-icon {
        opacity: 1;
    }
}

/* Mobile state-driven visibility (overrides sticky touch hover) */
@media (max-width: 767px) {
    .sidebar.collapsed .sidebar-logo {
        opacity: 1 !important;
    }
    .sidebar.collapsed .sidebar-bars-icon {
        opacity: 0 !important;
    }
    .sidebar:not(.collapsed) .sidebar-logo {
        opacity: 0 !important;
    }
    .sidebar:not(.collapsed) .sidebar-bars-icon {
        opacity: 1 !important;
    }
}

.menu-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recent-chats {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 4px;
    flex-shrink: 0;
}

.recent-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    min-height: 0;
    scroll-behavior: smooth;
}

.recent-scroll::-webkit-scrollbar {
    width: 4px;
}

.recent-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.recent-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.recent-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.recent-scroll-btns {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.recent-header:hover .recent-scroll-btns {
    opacity: 1;
}

.scroll-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.scroll-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

.sidebar.collapsed .recent-scroll-btns {
    display: none;
}

.section-title {
    font-size: clamp(0.75rem, 1.1vw, 0.9rem) !important;
    font-weight: 500;
    color: var(--text-main);
    padding: 6px 15px !important;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px !important;
    border-radius: 50px;
    color: var(--text-main);
    font-size: clamp(0.8rem, 1.2vw, 0.95rem) !important;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
    position: relative;
}

.history-item:hover {
    background-color: var(--hover-color);
    transform: translateX(4px);
}

.history-item .text {
    flex-grow: 1;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 65% !important;
}

.history-item .pin-dots {
    opacity: 0;
    pointer-events: none;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
}

.history-item:hover .pin-dots {
    opacity: 1;
    pointer-events: auto;
}

.bottom-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    width: 100%;
}

.sidebar.collapsed .bottom-actions {
    justify-content: center;
}

.theme-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 5px;
    margin: 8px 0 4px 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.sidebar.collapsed .theme-switch {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.theme-switch i {
    font-size: 12px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

[data-theme="dark"] .theme-switch .fa-sun {
    color: var(--text-muted);
}

[data-theme="dark"] .theme-switch .fa-moon {
    color: #A064FF;
}

[data-theme="light"] .theme-switch .fa-sun {
    color: #FFD700;
}

[data-theme="light"] .theme-switch .fa-moon {
    color: var(--text-muted);
}

.switch-track {
    width: 36px;
    height: 18px;
    background: var(--hover-color);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.switch-thumb {
    width: 14px;
    height: 14px;
    background: var(--text-main);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

[data-theme="light"] .switch-thumb {
    transform: translateX(18px);
}

[data-theme="dark"] .switch-track {
    background: rgba(160, 100, 255, 0.3);
}

[data-theme="light"] .switch-track {
    background: rgba(255, 215, 0, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 0;
    margin: 2px 0 4px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.sidebar.collapsed .user-profile {
    display: none;
}

.profile-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a064ff, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
}

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

.profile-initials {
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.profile-name {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    max-width: 0;
    transition: opacity 0.3s ease, max-width 0.3s ease;
}

.sidebar:not(.collapsed) .profile-name {
    opacity: 1;
    max-width: 150px;
}

/* ========================================= */
/* MAIN CHAT AREA */
/* ========================================= */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    background: var(--bg-main);
    overflow-x: hidden;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    min-height: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.main-content::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(6px, 1.5vw, 20px) clamp(12px, 3vw, 40px) 0;
    position: relative;
    min-height: 0;
}

.welcome-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    width: 100%;
    margin: 0 !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    gap: 8px;
    padding-left: 18px !important;
    padding-right: 18px !important;
    box-sizing: border-box !important;
}

.greeting-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    width: fit-content !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding-left: 18px !important;
    padding-right: 18px !important;
    box-sizing: border-box !important;
}

.greeting {
    font-size: 2.5rem !important;
    font-weight: 600 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.greeting span {
    font-size: inherit !important;
    font-weight: inherit !important;
}

.sub-greeting {
    font-size: 2rem !important;
    font-weight: 400 !important;
    margin-top: 10px !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    margin-bottom: 0 !important;
}

#dynamic-subtitle::after {
    content: '|';
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

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

.chat-messages {
    display: none;
    overflow-y: auto;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0 2px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    width: 100%;
    max-width: 820px;
    align-self: center;
    flex-grow: 1;
    min-height: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-messages.active {
    display: flex;
}

.chat-messages::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

.chat-messages::-webkit-scrollbar-track {
    display: none;
}

.chat-messages::-webkit-scrollbar-thumb {
    display: none;
}

.message {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 10px;
    animation: msgFadeIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes msgFadeIn {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
    flex-direction: column;
    align-items: flex-end;
}

.message.ai {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    max-width: 100%;
}

.message-text {
    width: fit-content !important;
    max-width: 90% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 14px 22px 30px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
}

.message.user .message-text {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.message.user .message-text::after {
    display: none;
}

.message.ai .message-text {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.message.ai .message-text::before {
    display: none;
}

.message-text-content {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-time {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.3px;
    user-select: none;
    flex-shrink: 0;
    line-height: 1;
    position: absolute;
    bottom: 8px;
    right: 22px;
    padding: 0;
    pointer-events: none;
}

.message.user .message-time {
    right: 22px;
}

.message.ai .message-time {
    right: 22px;
}

.message.user .message-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message.ai .message-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* =============================================
   Research Message — Premium Glassmorphism
   ============================================= */
.research-message .message-text {
    max-width: min(85%, 820px);
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.5), rgba(15, 15, 25, 0.6));
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 24px 28px 36px;
    box-shadow:
        0 0 0 1px rgba(160, 100, 255, 0.015),
        0 8px 48px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    animation: researchIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

@keyframes researchIn {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

[data-theme="light"] .research-message .message-text {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(245, 248, 252, 0.6));
    border-color: rgba(0, 0, 0, 0.04);
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.06);
}

.research-message .message-text-content {
    font-size: 14px;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.82);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    letter-spacing: 0.01em;
}

[data-theme="light"] .research-message .message-text-content {
    color: rgba(0, 0, 0, 0.78);
}

.research-message .message-text-content strong {
    color: rgba(160, 100, 255, 0.9);
    font-weight: 600;
}

.research-heading {
    display: block;
    font-size: 16px;
    font-weight: 650;
    color: rgba(255, 255, 255, 0.92);
    margin: 18px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    letter-spacing: -0.2px;
    line-height: 1.4;
}

.research-heading:first-child {
    margin-top: 0;
}

.research-para {
    margin: 0 0 12px;
    line-height: 1.85;
}

.research-bullet {
    display: block;
    padding: 2px 0 2px 16px;
    position: relative;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
}

.research-bullet::before {
    content: '•';
    position: absolute;
    left: 2px;
    color: rgba(160, 100, 255, 0.6);
    font-weight: bold;
}

[data-theme="light"] .research-heading {
    color: rgba(0, 0, 0, 0.88);
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .research-bullet {
    color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .research-bullet::before {
    color: rgba(124, 77, 255, 0.5);
}

[data-theme="light"] .research-message .message-text-content strong {
    color: rgba(124, 77, 255, 0.85);
}

.research-message .message-text-content em {
    font-style: italic;
    color: rgba(255, 255, 255, 0.6);
}

.research-message .message-time {
    bottom: 10px;
    right: 24px;
    opacity: 0.35;
    font-size: 10px;
}

.research-message .message-actions {
    padding-left: 8px;
}

/* Research mode indicator badge — removed as requested */

/* =============================================
   Code Block — Premium Glassmorphism
   ============================================= */
.code-block {
    margin: 12px 0 8px;
    border-radius: 14px;
    overflow: hidden;
    width: 100%;
    background: rgba(12, 12, 18, 0.6);
    backdrop-filter: blur(30px) saturate(1.4);
    -webkit-backdrop-filter: blur(30px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02),
        0 8px 40px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    animation: codeBlockSlideUp 0.4s ease forwards;
    will-change: transform;
}

@keyframes codeBlockSlideUp {
    0% {
        transform: translateY(12px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 12px;
    user-select: none;
}

.code-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.code-title {
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] .code-title {
    color: #0f172a;
}

.code-lang-badge {
    font-size: 9.5px;
    font-weight: 700;
    color: #c084fc;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.22);
    padding: 1.5px 6.5px;
    border-radius: 5px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    flex-shrink: 0;
}

[data-theme="light"] .code-lang-badge {
    color: #7e22ce;
    background: rgba(126, 34, 206, 0.08);
    border-color: rgba(126, 34, 206, 0.18);
}

.code-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.code-action-btn {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-muted, #94a3b8);
    border-radius: 6px;
    padding: 3.5px 9px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    line-height: 1;
}

.code-action-btn i {
    font-size: 11px;
    transition: transform 0.15s ease;
}

.code-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    transform: translateY(-0.5px);
}

.code-action-btn:active {
    transform: translateY(0);
}

.code-preview-btn {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    border-color: rgba(56, 189, 248, 0.2);
}

.code-preview-btn:hover {
    background: rgba(56, 189, 248, 0.18);
    border-color: rgba(56, 189, 248, 0.35);
    color: #7dd3fc;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.code-download-btn:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.25);
    color: #d8b4fe;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

[data-theme="light"] .code-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .code-action-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
    color: #475569;
}

[data-theme="light"] .code-action-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: #0f172a;
}

[data-theme="light"] .code-preview-btn {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.07);
    border-color: rgba(2, 132, 199, 0.18);
}

[data-theme="light"] .code-preview-btn:hover {
    background: rgba(2, 132, 199, 0.14);
    border-color: rgba(2, 132, 199, 0.28);
    color: #0369a1;
}

/* Legacy compatibility classes */
.code-lang {
    font-size: 11px;
    font-weight: 600;
    color: rgba(160, 100, 255, 0.6);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

[data-theme="light"] .code-lang {
    color: rgba(124, 77, 255, 0.5);
}

.code-copy {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
}

.code-copy:hover {
    background: rgba(160, 100, 255, 0.06);
    border-color: rgba(160, 100, 255, 0.1);
    color: rgba(160, 100, 255, 0.7);
}

.code-copy i {
    font-size: 12px;
}

[data-theme="light"] .code-copy {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .code-copy:hover {
    background: rgba(124, 77, 255, 0.04);
    border-color: rgba(124, 77, 255, 0.08);
    color: rgba(124, 77, 255, 0.6);
}

.code-body {
    display: flex;
    overflow-x: auto;
    max-height: 420px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.05) transparent;
}

.code-body::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

.code-body::-webkit-scrollbar-track {
    background: transparent;
}

.code-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.code-lines {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    user-select: none;
    min-width: 36px;
    border-right: none;
    background: transparent;
}

.code-line-num {
    padding: 0 10px 0 12px;
    font-size: 12px;
    line-height: 1.65;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    color: rgba(255, 255, 255, 0.15);
    text-align: right;
    min-height: 20px;
}

[data-theme="light"] .code-line-num {
    color: rgba(0, 0, 0, 0.12);
}

.code-content {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    overflow-x: auto;
    flex: 1;
}

.code-line {
    padding: 0 14px 0 16px;
    font-size: 13px;
    line-height: 1.65;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    white-space: pre;
    min-height: 20px;
    color: rgba(255, 255, 255, 0.75);
}

[data-theme="light"] .code-line {
    color: rgba(0, 0, 0, 0.7);
}

/* Syntax highlighting colors */
.code-comment {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

.code-string {
    color: #a8e6cf;
}

.code-keyword {
    color: #ff79c6;
}

.code-number {
    color: #bd93f9;
}

.code-literal {
    color: #ffb86c;
}

.code-tag {
    color: #ff79c6;
}

.code-attr {
    color: #8be9fd;
}

.code-punctuation {
    color: rgba(255, 255, 255, 0.3);
}

.code-hex {
    color: #50fa7b;
}

.code-key {
    color: #f1fa8c;
}

[data-theme="light"] .code-comment {
    color: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .code-string {
    color: #2d7a4a;
}

[data-theme="light"] .code-keyword {
    color: #d63384;
}

[data-theme="light"] .code-number {
    color: #7c4dff;
}

[data-theme="light"] .code-literal {
    color: #e65100;
}

[data-theme="light"] .code-tag {
    color: #d63384;
}

[data-theme="light"] .code-attr {
    color: #0288d1;
}

[data-theme="light"] .code-punctuation {
    color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .code-hex {
    color: #2e7d32;
}

[data-theme="light"] .code-key {
    color: #f57f17;
}

/* --- AI Message Actions (Copy, Like, Dislike, Share) --- */
.message-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 0 0 4px;
    flex-shrink: 0;
    min-height: 36px;
}

.msg-action {
    opacity: 0;
    animation: actionPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes actionPopIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(8px);
    }

    60% {
        opacity: 1;
        transform: scale(1.15) translateY(-2px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.msg-action {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

.msg-action:hover {
    color: var(--text-main);
    transform: scale(1.2);
}

.msg-action:active {
    transform: scale(0.9);
}

.msg-action.active {
    color: #A064FF;
}

.msg-action.active-like {
    color: #34a853;
}

.msg-action.active-dislike {
    color: #ea4335;
}

.msg-action.copied-action {
    color: #34a853;
}

[data-theme="light"] .msg-action.active {
    color: #7c4dff;
}

/* --- In-Chat Generation Progress Card --- */
.gen-progress-card {
    max-width: min(85%, 480px);
    padding: 18px 20px 16px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: genCardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes genCardIn {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

[data-theme="light"] .gen-progress-card {
    background: rgba(0, 0, 0, 0.02);
}

.gen-progress-prompt {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    word-break: break-word;
    line-height: 1.3;
}

.gen-progress-prompt i {
    color: #7c4dff;
    font-size: 12px;
    flex-shrink: 0;
}

.gen-progress-steps {
    display: flex;
    gap: 4px;
}

.gen-progress-step {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.gen-progress-step.active {
    opacity: 1;
    color: var(--text-main);
}

.gen-progress-step.done {
    opacity: 0.7;
    color: #34a853;
}

.gen-ps-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.gen-progress-step.active .gen-ps-dot {
    box-shadow: 0 0 8px rgba(124, 77, 255, 0.5);
    animation: genPsPulse 1s ease-in-out infinite;
}

@keyframes genPsPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.gen-progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

[data-theme="light"] .gen-progress-bar {
    background: rgba(0, 0, 0, 0.06);
}

.gen-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c4dff, #4285f4);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.gen-progress-pct {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    align-self: flex-end;
    font-variant-numeric: tabular-nums;
}

/* --- Image Result in Chat --- */
.message-text.image-result {
    max-width: min(85%, 360px);
    padding: 14px 16px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

[data-theme="light"] .message-text.image-result {
    background: rgba(0, 0, 0, 0.02);
}

.img-prompt-label {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    word-break: break-word;
}

.img-prompt-label i {
    color: #7c4dff;
    font-size: 12px;
    flex-shrink: 0;
}

[data-theme="light"] .img-prompt-label {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

.img-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 110px);
    gap: 4px;
    align-self: center;
}

.img-result-item {
    border-radius: 8px;
    overflow: hidden;
    width: 110px;
    height: 110px;
    opacity: 0;
    transform: scale(0.85) translateY(12px);
    animation: imgResultPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes imgResultPop {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(12px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.img-result-item img {
    width: 110px;
    height: 110px;
    display: block;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.img-result-item:hover img {
    transform: scale(1.05);
}

/* --- Image Bottom Row (timestamp + download/edit) --- */
.img-bottom-row {
    display: flex;
    align-items: center;
    margin-top: 6px;
    width: 100%;
}

.img-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.img-action-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    animation: imgActionIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
}

@keyframes imgActionIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(6px);
    }

    100% {
        opacity: 0.7;
        transform: scale(1) translateY(0);
    }
}

.img-action-btn:hover {
    opacity: 1 !important;
    color: var(--text-main);
    transform: scale(1.2);
}

.img-action-btn:active {
    transform: scale(0.9) !important;
}

.img-action-btn.done {
    color: #34a853;
    opacity: 1 !important;
}

[data-theme="light"] .img-action-btn.done {
    color: #34a853;
}

/* --- Video Result Play Overlay --- */
.vid-result-item {
    position: relative;
}

.vid-result-item i {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 8px;
}

.vid-result-item:hover i {
    opacity: 1;
}

/* --- Shopping Result Card --- */
.shopping-result {
    max-width: min(85%, 420px);
    padding: 16px 18px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: shoppingCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes shoppingCardIn {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

[data-theme="light"] .shopping-result {
    background: rgba(0, 0, 0, 0.02);
}

.shopping-header {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    word-break: break-word;
    animation: shopItemIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}

[data-theme="light"] .shopping-header {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

.shopping-header i {
    color: #34a853;
    font-size: 12px;
    flex-shrink: 0;
}

.shopping-product {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: shopItemIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

@keyframes shopItemIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.shopping-product-img {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--hover-color);
}

.shopping-product-info {
    flex: 1;
    min-width: 0;
}

.shopping-product-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 4px;
    line-height: 1.3;
}

.shopping-product-info p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.shopping-platforms {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .shopping-platforms {
    border-top-color: rgba(0, 0, 0, 0.04);
}

.shopping-platform {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
    animation: shopItemIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.shopping-platform:nth-child(1) {
    animation-delay: 0.3s;
}

.shopping-platform:nth-child(2) {
    animation-delay: 0.4s;
}

.shopping-platform:nth-child(3) {
    animation-delay: 0.5s;
}

.shopping-platform:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .shopping-platform {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .shopping-platform:hover {
    background: rgba(0, 0, 0, 0.04);
}

.platform-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 50px;
    flex-shrink: 0;
}

.platform-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
}
/* ========================================= */
/* THREAD LIFECYCLE & MEMORY TRANSFER (200-263 LIMIT) */
/* ========================================= */
.chat-warning-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
    width: 100%;
    max-width: 768px;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.chat-warning-banner.soft-warning {
    background: rgba(255, 179, 0, 0.12);
    border: 1px solid rgba(255, 179, 0, 0.3);
    color: #ffb300;
}

.chat-warning-banner.hard-lock {
    background: rgba(255, 77, 77, 0.12);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #ff4d4d;
}

.memory-transfer-actions {
    margin-top: 14px;
}

.transfer-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #7c4dff, #1a73e8);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.transfer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 77, 255, 0.5);
}

.buy-btn {
    padding: 4px 14px;
    border-radius: 6px;
    border: none;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.buy-btn:hover {
    transform: scale(1.05);
}

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

.buy-btn.amazon-btn {
    background: #ff9900;
}

.buy-btn.flipkart-btn {
    background: #2874f0;
}

.buy-btn.croma-btn {
    background: #e85d2b;
}

.shopping-result .message-time {
    position: static;
    margin-top: 8px;
    text-align: right;
    font-size: 10px;
    opacity: 0.4;
}

/* --- User message with inline image --- */
.msg-with-img {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px 6px;
    max-width: 280px;
}

.msg-img-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
    justify-content: flex-end;
}

.msg-inline-img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    cursor: zoom-in !important;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.msg-inline-img:hover {
    transform: scale(1.03);
    filter: brightness(1.05);
}

/* --- Image Preview inside Input (premium, cross on image) --- */
.editor-bottom-box {
    display: flex;
    align-items: center;
    margin: 0;
    padding-left: 58px;
    animation: editorSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 100%;
    box-sizing: border-box;
    order: -1;
}

@keyframes editorSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 90px;
    }
}

.editor-img-wrap {
    position: relative;
    display: inline-block;
    width: fit-content;
    border-radius: 6px;
    overflow: visible;
}

.editor-mini-img {
    display: block;
    width: 80px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    cursor: zoom-in !important;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.editor-mini-img:hover {
    transform: scale(1.03);
    filter: brightness(1.05);
}

.editor-file-icon {
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.editor-file-name {
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.editor-mini-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    border: none;
    background: rgba(20, 22, 28, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    line-height: 1;
}

.editor-mini-close:hover {
    transform: scale(1.2);
    background: #ea4335;
    box-shadow: 0 4px 14px rgba(234, 67, 53, 0.4);
    color: #fff;
}

/* --- Skill Badge at bottom of input --- */
.input-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-grow: 1;
    min-width: 0;
    width: 100%;
}

.skill-bottom-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(30, 31, 32, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: fit-content;
    animation: skillBadgeIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0 0 0 58px;
}

[data-theme="light"] .skill-bottom-badge {
    background: rgba(240, 244, 249, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
}

@keyframes skillBadgeIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(6px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.skill-bottom-badge i {
    font-size: 13px;
    flex-shrink: 0;
}

.skill-bottom-badge span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.skill-bottom-badge .badge-close {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
    font-size: 10px;
    padding: 0;
}

.skill-bottom-badge .badge-close:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

.skill-bottom-badge.hiding {
    animation: skillBadgeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes skillBadgeOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.7) translateY(8px);
    }
}

/* --- Skill icon in chat message --- */
.msg-skill-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(30, 31, 32, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

[data-theme="light"] .msg-skill-badge {
    background: rgba(240, 244, 249, 0.6);
    border-color: rgba(0, 0, 0, 0.06);
}

.msg-skill-badge i {
    font-size: 11px;
    flex-shrink: 0;
}

.msg-skill-badge span {
    color: var(--text-main);
    font-size: 11px;
}

.skill-bottom-badge .badge-close i {
    font-size: 10px;
}

/* ========================================= */
/* DOCUMENT PROCESSING ANIMATION BOX */
/* ========================================= */

.doc-processing-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--msg-ai-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    animation: docProcIn 0.5s cubic-bezier(0.21, 1.02, 0.73, 1);
    max-width: 420px;
    margin: 4px 0;
}

@keyframes docProcIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.doc-processing-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    position: relative;
}

.doc-processing-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 17px;
    border: 2px solid currentColor;
    opacity: 0.15;
}

.doc-processing-info {
    flex: 1;
    min-width: 0;
}

.doc-processing-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}

.doc-processing-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(128, 128, 128, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.doc-processing-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--brand-gradient);
    background-size: 200% auto;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.doc-processing-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    animation: barShimmer 1.5s ease-in-out infinite;
}

@keyframes barShimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.doc-processing-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-processing-status {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.doc-processing-percent {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* Ready state */

.doc-ready-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: var(--msg-ai-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    animation: docReadyIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 420px;
    margin: 4px 0;
}

@keyframes docReadyIn {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(12px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.doc-ready-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    background: rgba(128, 128, 128, 0.08);
}

.doc-ready-info {
    flex: 1;
    min-width: 0;
}

.doc-ready-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 2px;
}

.doc-ready-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.doc-ready-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.doc-ready-btn:hover {
    color: var(--text-main);
    transform: scale(1.25);
}

.doc-ready-btn:active {
    transform: scale(0.85);
}

.doc-ready-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.doc-ready-btn:hover i {
    animation: docDownloadHover 0.6s ease-in-out;
}

@keyframes docDownloadHover {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    20% {
        transform: translateY(-5px) rotate(-8deg);
    }

    40% {
        transform: translateY(3px) rotate(5deg);
    }

    60% {
        transform: translateY(-3px) rotate(-3deg);
    }

    80% {
        transform: translateY(2px) rotate(2deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }
}


.greeting span {
    font-size: clamp(28px, 5.5vw, 64px);
    font-weight: 500;
    background: var(--brand-gradient);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.sub-greeting {
    color: var(--text-muted);
    transition: opacity 0.3s ease;
}

@keyframes subGreetFade {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================= */
/* GEMINI INPUT PILL */
/* ========================================= */
.bottom-input-container {
    padding: clamp(10px, 2vw, 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.input-wrapper {
    width: 100%;
    max-width: 820px;
    background: rgba(20, 20, 20, 0.25);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50px;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    position: relative;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    gap: 4px;
}

.input-main-row {
    display: flex;
    align-items: flex-end;
    /* FIX 1: Taaki box bada hone par icons neeche rahen */
    width: 100%;
}

.input-wrapper:focus-within {
    border-color: rgba(160, 100, 255, 0.2);
    box-shadow: 0 4px 32px rgba(160, 100, 255, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .input-wrapper {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .input-wrapper:focus-within {
    border-color: rgba(124, 77, 255, 0.2);
    box-shadow: 0 4px 32px rgba(124, 77, 255, 0.06);
}

/* FIX 2: input ko textarea banaya aur height/overlap ki properties add ki */
.input-wrapper textarea {
    flex-grow: 1;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    padding: 12px 0px 12px 10px !important;
    text-align: left !important;
    resize: none;
    overflow-y: auto;
    max-height: 150px;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.add-btn {
    font-size: 14px;
    transition: 0.3s ease;
}

.add-btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-btn:hover i {
    transform: scale(1.15);
}

.add-btn:active i {
    animation: infinitySpin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes infinitySpin {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(360deg) scale(1.2);
        color: #A064FF;
    }

    100% {
        transform: rotate(720deg) scale(1);
    }
}

.btn-group {
    position: relative;
    display: flex;
    align-items: center;
}

.sound-btn,
.mic-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.icon-btn.sound-btn,
.icon-btn.mic-btn,
.icon-btn.add-btn,
.icon-btn.send-btn {
    border-radius: 0 !important;
}

.icon-btn.sound-btn:hover,
.icon-btn.mic-btn:hover,
.icon-btn.add-btn:hover,
.icon-btn.send-btn:hover {
    background-color: transparent !important;
}

.sound-btn i,
.mic-btn i,
.send-btn i {
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.sound-btn:hover i,
.mic-btn:hover i,
.send-btn:hover i {
    transform: scale(1.2);
    opacity: 0.7;
}

.sound-btn:active i,
.mic-btn:active i,
.send-btn:active i {
    animation: btnPulse 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes btnPulse {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.15);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.sound-btn,
.mic-btn,
.send-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mic-btn {
    position: relative;
}

/* NOX Voice Capsule & Hardware Visualizer */
.mic-btn.is-recording {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 82px !important;
    max-width: max-content !important;
    height: 36px !important;
    padding: 0 12px !important;
    border-radius: 18px !important;
    background: rgba(245, 158, 11, 0.12) !important;
    border: 1px solid rgba(245, 158, 11, 0.5) !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.25), inset 0 0 8px rgba(245, 158, 11, 0.1) !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 10;
}

.mic-btn.is-recording:hover {
    background: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.75) !important;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4) !important;
}

.chat-input-wrapper .btn-group,
.input-main-row .btn-group,
.btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Equalizer Bars Container */
.nox-voice-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3.5px;
    height: 24px;
    pointer-events: none;
}

/* Individual Equalizer Bars (Hardware-Coupled) */
.nox-vbar {
    display: inline-block;
    width: 3px;
    height: 3px;
    min-height: 3px;
    max-height: 22px;
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 3px;
    opacity: 0.45;
    transition: height 0.06s ease, opacity 0.12s ease;
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}

/* Glowing Neon Stop Button */
.nox-voice-stop {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.6);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
    transition: all 0.2s ease;
    pointer-events: auto;
    margin-left: 2px;
}

.nox-voice-stop i {
    font-size: 9px !important;
    color: #f59e0b !important;
    text-shadow: 0 0 6px rgba(245, 158, 11, 0.8) !important;
    transform: none !important;
    transition: transform 0.2s ease !important;
}

.mic-btn.is-recording:hover .nox-voice-stop {
    background: rgba(245, 158, 11, 0.35);
    border-color: rgba(245, 158, 11, 0.85);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.mic-btn.is-recording:hover .nox-voice-stop i {
    transform: scale(1.15) !important;
    color: #fbbf24 !important;
}

/* Transcribing State — Whisper STT Processing Spinner */
.mic-btn.is-transcribing {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(245, 158, 11, 0.08) !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.2) !important;
    cursor: wait !important;
    flex-shrink: 0 !important;
    animation: sttPulse 1.8s ease-in-out infinite !important;
    pointer-events: none !important;
}

.mic-btn.is-transcribing i {
    font-size: 16px !important;
    color: #f59e0b !important;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.6) !important;
}

@keyframes sttPulse {
    0%, 100% {
        box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
        border-color: rgba(245, 158, 11, 0.35);
    }
    50% {
        box-shadow: 0 0 24px rgba(245, 158, 11, 0.4);
        border-color: rgba(245, 158, 11, 0.7);
    }
}

.mic-btn.recording {
    color: #ff4444;
    animation: recPulse 1s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

@keyframes recPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.sound-btn.slide-left,
.mic-btn.slide-left {
    transform: translateX(-38px);
}

.send-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-btn.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.send-btn.loading {
    width: 28px;
    height: 28px;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #ff5a5a, #d40b0b);
    border: none;
    box-shadow: 0 0 10px rgba(255, 60, 60, 0.5), 0 0 25px rgba(255, 60, 60, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    right: 6px;
    opacity: 1;
    animation: loadingBreathe 0.9s ease-in-out infinite;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes loadingBreathe {
    0% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 10px rgba(255, 60, 60, 0.5), 0 0 25px rgba(255, 60, 60, 0.2);
    }

    50% {
        transform: translateY(-50%) scale(1.08);
        box-shadow: 0 0 18px rgba(255, 60, 60, 0.7), 0 0 40px rgba(255, 60, 60, 0.3);
    }

    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 10px rgba(255, 60, 60, 0.5), 0 0 25px rgba(255, 60, 60, 0.2);
    }
}

.send-btn.loading i {
    display: block;
    width: 14px;
    height: 14px;
    border: 2.5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-right-color: #fff;
    border-radius: 50%;
    animation: spinLoader 0.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    font-size: 0;
}

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

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

/* --- Active Mode Badge (Image/Video) --- */
.active-mode-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 50px;
    background: rgba(30, 31, 32, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: auto;
    margin: 0;
    align-self: flex-start;
    transition: 0.2s;
}

[data-theme="light"] .active-mode-badge {
    background: rgba(240, 244, 249, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
}

.active-mode-badge i {
    font-size: 14px;
    color: var(--text-muted);
}

.active-mode-badge span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.active-mode-badge .badge-close {
    width: 0;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
    opacity: 0;
    overflow: hidden;
    padding: 0;
}

.active-mode-badge:hover .badge-close {
    width: 22px;
    opacity: 1;
}

.active-mode-badge .badge-close:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

.active-mode-badge .badge-close i {
    font-size: 12px;
}

.input-wrapper.image-mode {
    max-width: 960px;
    padding-bottom: 8px;
    border-radius: 24px;
}

/* --- Image Showcase (4 groups, 2x2 grid) --- */
.image-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
    padding: 0;
    justify-items: center;
    animation: showcaseFadeIn 0.5s ease;
    max-width: 400px;
    margin: 24px auto 0;
}

@keyframes showcaseFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.showcase-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.group-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.group-images {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    width: 168px;
}

.group-images img {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    transition: opacity 0.4s ease;
    background: var(--hover-color);
}

.vid-thumb {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.vid-thumb img {
    width: 100%;
    height: 100%;
    display: block;
}

.vid-thumb i {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.vid-thumb:hover i {
    opacity: 1;
}

.disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 33px;
    text-align: center;
}

/* --- Floating Glass Popup --- */
.floating-popup {
    position: fixed;
    background: rgba(30, 31, 32, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .floating-popup {
    background: rgba(240, 244, 249, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.floating-popup.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.popup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s ease;
    color: var(--text-muted);
}

.popup-item:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

.popup-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.popup-item span {
    font-size: 13px;
    white-space: nowrap;
    font-weight: 500;
}

/* --- Sub Popup --- */
#upload-item,
#mode-item,
#skills-item {
    position: relative;
}

.mode-s-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mode-s-icon i {
    font-size: 12px;
    color: #fff;
    width: auto;
}

#mode-sub-popup>.popup-item.mode-active {
    background: rgba(124, 77, 255, 0.1);
    border-color: rgba(124, 77, 255, 0.15);
}

.sub-popup {
    position: absolute;
    left: calc(100% + 12px);
    top: auto;
    bottom: 0;
    background: rgba(30, 31, 32, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transform: translateX(-6px) scale(0.95);
    pointer-events: none;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0s;
    z-index: 110;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

#upload-item>.sub-popup {
    min-width: 140px;
}

#mode-sub-popup {
    min-width: 120px;
}

#skills-sub-popup {
    min-width: 100px;
}

[data-theme="light"] .sub-popup {
    background: rgba(240, 244, 249, 0.75);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

#upload-item.active>.sub-popup,
#mode-item.active>.sub-popup,
#skills-item.active>.sub-popup,
.sub-popup:hover {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}

/* --- Drive Connect Popup --- */
.drive-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.drive-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.drive-popup {
    background: rgba(30, 31, 32, 0.8);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px 36px 28px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.drive-overlay.show .drive-popup {
    transform: scale(1) translateY(0);
}

[data-theme="light"] .drive-popup {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
}

.drive-logo {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: linear-gradient(135deg, #4285f4, #34a853, #fbbc04, #ea4335);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 8px 32px rgba(66, 133, 244, 0.2);
}

.drive-logo i {
    font-size: 36px;
    color: #fff;
}

.drive-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}

.drive-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 28px;
}

.drive-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.drive-btn {
    padding: 10px 24px;
    border-radius: 50px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.cancel-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cancel-btn:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

[data-theme="light"] .cancel-btn {
    border-color: rgba(0, 0, 0, 0.1);
}

.connect-btn {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: #fff;
}

.connect-btn:hover {
    transform: translateY(-2px);
}

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

/* --- Tools Connect Popup --- */
.drive-overlay {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* --- Tools Connect Popup --- */
#tools-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000000 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#tools-overlay.show {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

.tools-popup {
    width: min(92vw, 440px);
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    background: rgba(18, 18, 22, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    transform: scale(0.95) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

#tools-overlay.show .tools-popup {
    transform: scale(1) translateY(0);
}

[data-theme="light"] .tools-popup {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

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

[data-theme="light"] .tools-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.tools-title {
    font-size: clamp(16px, 3.5vw, 20px);
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.tools-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.tools-close:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

.tools-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 52vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    padding-bottom: 4px;
    margin-top: 6px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

[data-theme="light"] .tools-list {
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.tools-list::-webkit-scrollbar {
    width: 5px;
}

.tools-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

.tools-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.tools-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="light"] .tools-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .tools-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tools-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-muted);
    user-select: none;
}

[data-theme="light"] .tool-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
}

.tool-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

[data-theme="light"] .tool-card:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.1);
}

.tool-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-icon i {
    font-size: 16px;
    color: #fff;
}

.tool-card span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   NOX GOOGLE DRIVE 1:1 REPLICA & BIDIRECTIONAL LINKAGE
   ========================================================================== */
#nox-drive-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000005 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px;
    box-sizing: border-box;
}

#nox-drive-modal.show {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

.nox-drive-dialog {
    position: relative;
    width: min(96vw, 1180px);
    height: min(90vh, 820px);
    background: #131314;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.97) translateY(12px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Google Sans', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
}

#nox-drive-modal.show .nox-drive-dialog {
    transform: scale(1) translateY(0);
}

[data-theme="light"] .nox-drive-dialog {
    background: #f8fafd;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* 1. MD3 Top Bar */
.nox-drive-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #1e1f20;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 16px;
    user-select: none;
}

[data-theme="light"] .nox-drive-topbar {
    background: #f8fafd;
    border-bottom-color: #e0e2ec;
}

.nox-drive-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
}

.nox-drive-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.nox-drive-logo-fallback {
    font-size: 24px;
    color: #4285f4;
}

.nox-drive-brand-text {
    font-size: 20px;
    font-weight: 500;
    color: #e3e3e3;
    letter-spacing: -0.01em;
}

[data-theme="light"] .nox-drive-brand-text {
    color: #1f1f1f;
}

.nox-drive-bridge-badge {
    font-size: 11px;
    font-weight: 600;
    color: #8ab4f8;
    background: rgba(138, 180, 248, 0.12);
    border: 1px solid rgba(138, 180, 248, 0.28);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Topbar Search */
.nox-drive-search-container {
    flex: 1;
    max-width: 640px;
}

.nox-drive-search-bar {
    display: flex;
    align-items: center;
    background: #282a2c;
    border-radius: 28px;
    padding: 4px 14px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
}

.nox-drive-search-bar:focus-within {
    background: #1e1f20;
    border-color: rgba(138, 180, 248, 0.6);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .nox-drive-search-bar {
    background: #edf2fc;
}

[data-theme="light"] .nox-drive-search-bar:focus-within {
    background: #ffffff;
    border-color: #1a73e8;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.nox-drive-search-icon-btn, .nox-drive-search-clear-btn, .nox-drive-search-tune-btn {
    background: transparent;
    border: none;
    color: #8e918f;
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.15s ease, background 0.15s ease;
}

.nox-drive-search-icon-btn:hover, .nox-drive-search-tune-btn:hover {
    color: #e3e3e3;
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .nox-drive-search-icon-btn:hover, [data-theme="light"] .nox-drive-search-tune-btn:hover {
    color: #1f1f1f;
    background: rgba(0, 0, 0, 0.06);
}

.nox-drive-search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e3e3e3;
    font-size: 14px;
    padding: 6px 10px;
}

[data-theme="light"] .nox-drive-search-bar input {
    color: #1f1f1f;
}

/* Topbar Actions */
.nox-drive-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nox-drive-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #8e918f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.nox-drive-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e3e3e3;
}

[data-theme="light"] .nox-drive-icon-btn {
    color: #444746;
}

[data-theme="light"] .nox-drive-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f1f1f;
}

.nox-drive-icon-btn.nox-drive-close-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.nox-drive-user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3px 10px 3px 4px;
    border-radius: 20px;
}

[data-theme="light"] .nox-drive-user-pill {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

.nox-drive-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #4285f4;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nox-drive-user-email {
    font-size: 12px;
    font-weight: 500;
    color: #e3e3e3;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .nox-drive-user-email {
    color: #1f1f1f;
}

/* 2. Main Two-Column Layout */
.nox-drive-main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #131314;
}

[data-theme="light"] .nox-drive-main-layout {
    background: #f8fafd;
}

/* Sidebar */
.nox-drive-sidebar {
    width: 230px;
    background: #131314;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
    gap: 12px;
    flex-shrink: 0;
}

[data-theme="light"] .nox-drive-sidebar {
    background: #f8fafd;
    border-right-color: #e0e2ec;
}

.nox-drive-new-btn-wrap {
    margin-bottom: 4px;
    position: relative;
}

.nox-drive-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #282a2c;
    color: #e3e3e3;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.nox-drive-new-btn:hover {
    background: #333538;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transform: translateY(-1px);
}

[data-theme="light"] .nox-drive-new-btn {
    background: #ffffff;
    color: #1f1f1f;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .nox-drive-new-btn:hover {
    background: #f1f3f4;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
}

.nox-drive-plus-icon {
    flex-shrink: 0;
}

.nox-drive-new-caret {
    font-size: 11px;
    margin-left: 2px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.nox-drive-new-btn.active .nox-drive-new-caret {
    transform: rotate(180deg);
}

/* + New Dropdown Menu */
.nox-drive-new-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #282a2c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    min-width: 195px;
    user-select: none;
    animation: driveMenuFadeIn 0.15s ease-out;
}

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

[data-theme="light"] .nox-drive-new-menu {
    background: #ffffff;
    border-color: #e0e2ec;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.nox-drive-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    color: #e3e3e3;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-weight: 500;
    transition: background 0.15s ease;
}

[data-theme="light"] .nox-drive-menu-item {
    color: #1f1f1f;
}

.nox-drive-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .nox-drive-menu-item:hover {
    background: #edf2fc;
}

.nox-drive-menu-item i {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.nox-drive-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 6px;
}

[data-theme="light"] .nox-drive-menu-divider {
    background: #e0e2ec;
}

.nox-drive-nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.nox-drive-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 16px;
    border-radius: 20px;
    border: none;
    background: transparent;
    color: #8e918f;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
}

.nox-drive-nav-item i {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.nox-drive-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e3e3e3;
}

.nox-drive-nav-item.active {
    background: #004a77;
    color: #c2e7ff;
    font-weight: 600;
}

[data-theme="light"] .nox-drive-nav-item {
    color: #444746;
}

[data-theme="light"] .nox-drive-nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1f1f1f;
}

[data-theme="light"] .nox-drive-nav-item.active {
    background: #c2e7ff;
    color: #001d35;
}

.nox-drive-nav-arrow {
    margin-left: auto;
    font-size: 10px !important;
    opacity: 0.6;
}

.nox-drive-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 6px 8px;
}

[data-theme="light"] .nox-drive-nav-divider {
    background: #e0e2ec;
}

.nox-drive-sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nox-drive-disconnect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.nox-drive-disconnect-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

[data-theme="light"] .nox-drive-disconnect-btn {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

[data-theme="light"] .nox-drive-disconnect-btn:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

.nox-drive-storage-widget {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

[data-theme="light"] .nox-drive-storage-widget {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

.nox-drive-storage-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #e3e3e3;
}

[data-theme="light"] .nox-drive-storage-header {
    color: #1f1f1f;
}

.nox-drive-storage-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

[data-theme="light"] .nox-drive-storage-bar {
    background: rgba(0, 0, 0, 0.08);
}

.nox-drive-storage-fill {
    width: 0%;
    height: 100%;
    background: #4285f4;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.nox-drive-storage-text {
    font-size: 11px;
    color: #8e918f;
}

/* Right Content Panel */
.nox-drive-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e1f20;
    border-top-left-radius: 20px;
    margin: 8px 8px 8px 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .nox-drive-content-panel {
    background: #ffffff;
    border-color: #e0e2ec;
}

/* Content Header */
.nox-drive-content-header {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

[data-theme="light"] .nox-drive-content-header {
    border-bottom-color: #e0e2ec;
}

.nox-drive-breadcrumbs-wrap {
    display: flex;
    align-items: center;
}

.nox-drive-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: 500;
    color: #e3e3e3;
    overflow-x: auto;
}

[data-theme="light"] .nox-drive-breadcrumbs {
    color: #1f1f1f;
}

.nox-drive-crumb {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.nox-drive-crumb:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .nox-drive-crumb:hover {
    background: rgba(0, 0, 0, 0.05);
}

.nox-drive-crumb.active {
    cursor: default;
    color: #e3e3e3;
    font-weight: 600;
}

[data-theme="light"] .nox-drive-crumb.active {
    color: #1f1f1f;
}

.nox-drive-crumb-sep {
    color: #8e918f;
    font-size: 11px;
}

.nox-drive-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nox-drive-filter-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
}

.nox-drive-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #8e918f;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.nox-drive-chip:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e3e3e3;
}

.nox-drive-chip.active {
    background: #004a77;
    border-color: #004a77;
    color: #c2e7ff;
    font-weight: 600;
}

[data-theme="light"] .nox-drive-chip {
    border-color: #c4c7c5;
    color: #444746;
}

[data-theme="light"] .nox-drive-chip:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1f1f1f;
}

[data-theme="light"] .nox-drive-chip.active {
    background: #c2e7ff;
    border-color: #c2e7ff;
    color: #001d35;
}

.nox-drive-view-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 2px;
}

[data-theme="light"] .nox-drive-view-controls {
    background: #f1f3f4;
    border-color: #e0e2ec;
}

.nox-drive-view-btn {
    width: 30px;
    height: 28px;
    border: none;
    background: transparent;
    color: #8e918f;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nox-drive-view-btn.active {
    background: #4285f4;
    color: #fff;
    box-shadow: 0 1px 4px rgba(66, 133, 244, 0.4);
}

/* Scroll Area & Sections */
.nox-drive-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nox-drive-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nox-drive-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #8e918f;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

[data-theme="light"] .nox-drive-section-title {
    color: #444746;
}

/* Folders Grid */
.nox-drive-folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.nox-drive-folder-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #131314;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.nox-drive-folder-card:hover {
    background: #282a2c;
    border-color: rgba(66, 133, 244, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .nox-drive-folder-card {
    background: #f8fafd;
    border-color: #e0e2ec;
}

[data-theme="light"] .nox-drive-folder-card:hover {
    background: #edf2fc;
    border-color: #1a73e8;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.nox-drive-folder-icon {
    font-size: 20px;
    color: #fbbc04;
    flex-shrink: 0;
}

.nox-drive-folder-name {
    font-size: 13.5px;
    font-weight: 500;
    color: #e3e3e3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .nox-drive-folder-name {
    color: #1f1f1f;
}

/* Files Grid (MD3 Cards) */
.nox-drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
}

.nox-drive-item {
    background: #131314;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.nox-drive-item:hover {
    background: #282a2c;
    border-color: rgba(66, 133, 244, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .nox-drive-item {
    background: #ffffff;
    border-color: #e0e2ec;
}

[data-theme="light"] .nox-drive-item:hover {
    background: #ffffff;
    border-color: #1a73e8;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.nox-drive-item-preview {
    height: 110px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .nox-drive-item-preview {
    background: #f8fafd;
}

.nox-drive-item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nox-drive-item-icon-lg {
    font-size: 42px;
}

.nox-drive-item-meta {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .nox-drive-item-meta {
    border-top-color: #f1f3f4;
}

.nox-drive-item-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nox-drive-item-mime-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.nox-drive-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #e3e3e3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

[data-theme="light"] .nox-drive-item-name {
    color: #1f1f1f;
}

.nox-drive-item-sub {
    font-size: 11.5px;
    color: #8e918f;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[data-theme="light"] .nox-drive-item-sub {
    color: #747775;
}

/* Actions in Card */
.nox-drive-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 10px;
}

.nox-drive-send-nox-btn {
    flex: 1;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.2), rgba(245, 158, 11, 0.15));
    border: 1px solid rgba(66, 133, 244, 0.4);
    color: #8ab4f8;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 11.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nox-drive-send-nox-btn:hover {
    background: linear-gradient(135deg, #4285f4, #f59e0b);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
    transform: translateY(-1px);
}

.nox-drive-item-open-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8e918f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.nox-drive-item-open-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e3e3e3;
}

[data-theme="light"] .nox-drive-item-open-btn {
    background: #edf2fc;
    border-color: #e0e2ec;
    color: #444746;
}

[data-theme="light"] .nox-drive-item-open-btn:hover {
    background: #e0e2ec;
    color: #1f1f1f;
}

.nox-drive-item-more-btn,
.nox-drive-folder-more-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #8e918f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.nox-drive-item-more-btn:hover,
.nox-drive-folder-more-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

[data-theme="light"] .nox-drive-item-more-btn,
[data-theme="light"] .nox-drive-folder-more-btn {
    color: #5f6368;
}

[data-theme="light"] .nox-drive-item-more-btn:hover,
[data-theme="light"] .nox-drive-folder-more-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1f1f1f;
}

/* List View (Table Format) */
.nox-drive-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nox-drive-grid.list-view .nox-drive-item {
    flex-direction: row;
    align-items: center;
    padding: 8px 16px;
    gap: 16px;
    border-radius: 10px;
}

.nox-drive-grid.list-view .nox-drive-item-preview {
    display: none;
}

.nox-drive-grid.list-view .nox-drive-item-meta {
    flex: 1;
    padding: 0;
    border-top: none;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.nox-drive-grid.list-view .nox-drive-item-title-row {
    flex: 1;
    max-width: 45%;
}

.nox-drive-grid.list-view .nox-drive-item-actions {
    padding: 0;
}

/* States: Loading, Empty, Error */
.nox-drive-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 280px;
    text-align: center;
    color: #8e918f;
    gap: 12px;
}

.nox-drive-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(66, 133, 244, 0.2);
    border-top-color: #4285f4;
    border-radius: 50%;
    animation: driveSpin 0.8s linear infinite;
}

.nox-drive-empty-img {
    width: 140px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.nox-drive-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #e3e3e3;
    margin: 0;
}

[data-theme="light"] .nox-drive-empty-title {
    color: #1f1f1f;
}

.nox-drive-empty-desc {
    font-size: 13px;
    margin: 0;
    color: #8e918f;
}

.nox-drive-error-icon {
    font-size: 42px;
    color: #ef4444;
}

.nox-drive-reauth-btn {
    margin-top: 8px;
    background: #4285f4;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.nox-drive-reauth-btn:hover {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

/* Statusbar */
.nox-drive-statusbar {
    padding: 8px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #8e918f;
    background: #131314;
    user-select: none;
}

[data-theme="light"] .nox-drive-statusbar {
    border-top-color: #e0e2ec;
    background: #f8fafd;
}

.nox-drive-status-hint {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Right-Click Context Menu */
.nox-drive-context-menu {
    position: fixed;
    background: #282a2c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1000020;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    min-width: 200px;
    user-select: none;
}

[data-theme="light"] .nox-drive-context-menu {
    background: #ffffff;
    border-color: #e0e2ec;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.nox-drive-ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #e3e3e3;
    cursor: pointer;
    transition: background 0.15s ease;
}

[data-theme="light"] .nox-drive-ctx-item {
    color: #1f1f1f;
}

.nox-drive-ctx-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .nox-drive-ctx-item:hover {
    background: #edf2fc;
}

.nox-drive-ctx-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 6px;
}

[data-theme="light"] .nox-drive-ctx-divider {
    background: #e0e2ec;
}

/* Google Drive MD3 Bottom-Right Upload Toast / Status Dialog (Contained in Drive Modal) */
.nox-drive-upload-toast {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000030;
    width: 360px;
    max-width: calc(100% - 32px);
    border-radius: 16px;
    overflow: hidden;
    background: #1e1f20;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    font-family: 'Google Sans', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    animation: driveToastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes driveToastSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="light"] .nox-drive-upload-toast {
    background: #ffffff;
    border-color: #e0e2ec;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.nox-drive-upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #282a2c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    user-select: none;
    cursor: pointer;
}

[data-theme="light"] .nox-drive-upload-header {
    background: #f1f3f4;
    border-bottom-color: #e0e2ec;
}

.nox-drive-upload-header-title {
    font-size: 13.5px;
    font-weight: 500;
    color: #e3e3e3;
}

[data-theme="light"] .nox-drive-upload-header-title {
    color: #1f1f1f;
}

.nox-drive-upload-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nox-drive-upload-icon-btn {
    background: transparent;
    border: none;
    color: #8e918f;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
}

.nox-drive-upload-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e3e3e3;
}

[data-theme="light"] .nox-drive-upload-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1f1f1f;
}

.nox-drive-upload-body {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), padding 0.25s ease;
}

.nox-drive-upload-toast.collapsed .nox-drive-upload-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.nox-drive-upload-toast.collapsed #nox-drive-upload-collapse-icon {
    transform: rotate(180deg);
}

.nox-drive-upload-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nox-drive-upload-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .nox-drive-upload-item {
    background: rgba(0, 0, 0, 0.02);
}

.nox-drive-upload-item-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nox-drive-upload-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nox-drive-upload-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #e3e3e3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .nox-drive-upload-item-name {
    color: #1f1f1f;
}

.nox-drive-upload-item-status-text {
    font-size: 11.5px;
    color: #8e918f;
}

.nox-drive-upload-item-state {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.nox-drive-upload-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(66, 133, 244, 0.2);
    border-top-color: #4285f4;
    border-radius: 50%;
    animation: driveSpin 0.7s linear infinite;
}

/* Responsive */
@media (max-width: 768px) {
    #nox-drive-modal {
        padding: 0;
    }
    .nox-drive-dialog {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
    }
    .nox-drive-sidebar {
        display: none;
    }
    .nox-drive-content-panel {
        margin: 0;
        border-radius: 0;
        border: none;
    }
    .nox-drive-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* ========================================= */
/* SEARCH OVERLAY — Glass Popup */
/* ========================================= */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 99999 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding-top: 10vh;
}

.search-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.search-popup {
    background: rgba(30, 31, 32, 0.75);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    max-width: 520px;
    width: 90%;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.search-overlay.show .search-popup {
    transform: scale(1) translateY(0);
}

[data-theme="light"] .search-popup {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.1);
}

.search-popup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

[data-theme="light"] .search-popup-header {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

.search-popup-header i {
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-popup-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 15px;
    font-family: inherit;
}

.search-popup-input::placeholder {
    color: var(--text-muted);
}

.search-popup-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: 0.2s;
    flex-shrink: 0;
}

.search-popup-close:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

.search-popup-results {
    overflow-y: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 100px;
}

.search-popup-results::-webkit-scrollbar {
    display: none;
}

.search-popup-results {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.search-popup-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-main);
    font-size: 14px;
    transition: all 0.2s ease;
    animation: searchItemIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.search-popup-item:nth-child(1) {
    animation-delay: 0.02s;
}

.search-popup-item:nth-child(2) {
    animation-delay: 0.04s;
}

.search-popup-item:nth-child(3) {
    animation-delay: 0.06s;
}

.search-popup-item:nth-child(4) {
    animation-delay: 0.08s;
}

.search-popup-item:nth-child(5) {
    animation-delay: 0.10s;
}

.search-popup-item:nth-child(6) {
    animation-delay: 0.12s;
}

.search-popup-item:nth-child(7) {
    animation-delay: 0.14s;
}

.search-popup-item:nth-child(8) {
    animation-delay: 0.16s;
}

.search-popup-item:nth-child(9) {
    animation-delay: 0.18s;
}

.search-popup-item:nth-child(10) {
    animation-delay: 0.20s;
}

@keyframes searchItemIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes libItemIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(15px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.search-popup-item:hover {
    background: var(--hover-color);
    transform: translateX(4px);
}

.search-popup-item i {
    font-size: 14px;
    color: var(--text-muted);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.search-popup-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.search-popup-empty i {
    font-size: 28px;
    opacity: 0.5;
}

.search-popup-empty.show {
    display: flex;
}

@media (max-width: 479px) {
    .search-popup {
        max-width: 95%;
        max-height: 70vh;
        border-radius: 16px;
    }

    .search-popup-header {
        padding: 12px 14px;
    }

    .search-popup-input {
        font-size: 14px;
    }

    .search-popup-item {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ========================================= */
/* LIBRARY POPUP — All Generated Media */
/* ========================================= */
.library-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.library-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.library-popup {
    background: rgba(30, 31, 32, 0.8);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    max-width: 640px;
    width: 92%;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 32px 120px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.library-overlay.show .library-popup {
    transform: scale(1) translateY(0);
}

[data-theme="light"] .library-popup {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 32px 120px rgba(0, 0, 0, 0.12);
}

.library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

[data-theme="light"] .library-header {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

.library-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.library-title i {
    color: var(--text-muted);
    font-size: 16px;
}

.library-close {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: 0.2s;
}

.library-close:hover {
    background: var(--hover-color);
    color: var(--text-main);
}

.library-body {
    overflow-y: auto;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    min-height: 120px;
}

.library-body::-webkit-scrollbar {
    display: none;
}

.library-body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.lib-media-item {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1;
    animation: libItemIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.lib-media-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lib-media-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lib-media-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 10px;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lib-media-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 50px 20px;
    color: var(--text-muted);
    text-align: center;
    font-size: 14px;
}

.library-empty i {
    font-size: 36px;
    opacity: 0.4;
}

.library-empty.show {
    display: flex;
}

@media (max-width: 479px) {
    .library-popup {
        max-width: 96%;
        border-radius: 18px;
    }

    .library-body {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px 14px;
    }

    .library-header {
        padding: 14px 16px 12px;
    }

    .library-title {
        font-size: 16px;
    }
}

/* ========================================= */
/* RESPONSIVE — All Devices A-Z */
/* ========================================= */

/* --- Large Desktops & Monitors (> 1920px) --- */
@media (min-width: 1921px) {
    .input-wrapper {
        max-width: 960px;
    }

    .input-wrapper.image-mode {
        max-width: 1080px;
    }

    .welcome-center {
        max-width: 1000px;
    }

    .image-showcase {
        max-width: 460px;
    }

    .group-images img {
        width: 48px;
        height: 48px;
    }

    .vid-thumb {
        width: 48px;
        height: 48px;
    }

    .vid-thumb i {
        font-size: 14px;
    }

    .group-images {
        width: 200px;
    }
}

/* ========================================= */
/* RESPONSIVE — Minimal tweaks only */
/* ========================================= */

@media (max-width: 1280px) {
    .input-wrapper {
        max-width: 700px;
    }

    .input-wrapper.image-mode {
        max-width: 820px;
    }

    .welcome-center {
        max-width: 680px;
    }

    .sidebar {
        width: 250px;
    }

    .sidebar.collapsed {
        width: 76px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .sidebar.collapsed {
        width: 68px;
    }

    .input-wrapper {
        max-width: 600px;
    }

    .input-wrapper.image-mode {
        max-width: 700px;
    }

    .welcome-center {
        max-width: 560px;
    }

    .tools-popup {
        width: min(92vw, 420px);
        max-width: 420px;
        padding: 20px;
    }

    .tools-title {
        font-size: 17px;
    }

    .tools-list {
        gap: 10px;
    }

    .tool-icon {
        width: 30px;
        height: 30px;
    }

    .tool-icon i {
        font-size: 15px;
    }

    .drive-popup {
        max-width: 280px;
        padding: 30px 24px 24px;
    }

    .drive-logo {
        width: 56px;
        height: 56px;
        margin-bottom: 16px;
    }

    .drive-logo i {
        font-size: 28px;
    }

    .drive-title {
        font-size: 18px;
    }

    .drive-desc {
        margin-bottom: 20px;
    }

    .image-showcase {
        gap: 12px 18px;
    }

    .group-images {
        width: 152px;
    }

    .group-images img {
        width: 36px;
        height: 36px;
    }

    .vid-thumb {
        width: 36px;
        height: 36px;
    }

    .vid-thumb i {
        font-size: 10px;
    }

    .group-title {
        font-size: 11px;
    }

    .menu-btn {
        width: 48px;
        height: 48px;
    }

    .sidebar-logo {
        width: 48px;
        height: 48px;
    }

    .sidebar-bars-icon {
        font-size: 18px;
    }

    .brand-text {
        font-size: 14px;
    }

    .new-chat-btn {
        font-size: 13px;
        margin-left: 10px !important;
        margin-top: 15px !important;
        margin-bottom: 8px !important;
        position: relative !important;
        z-index: 99999 !important;
        pointer-events: auto !important;
        transform: none !important;
        left: auto !important;
    }

    .search-section {
        margin-left: 10px !important;
        margin-bottom: 8px !important;
    }

    .media-options {
        margin-left: 10px !important;
        margin-bottom: 8px !important;
    }

    .media-options .media-item {
        margin-left: 0 !important;
    }

    .library-sidebar {
        margin-left: 10px !important;
        margin-bottom: 8px !important;
    }

    .library-sidebar .text {
        font-size: 13px;
    }

    .video-sidebar {
        margin-left: 10px !important;
        margin-bottom: 8px !important;
    }
}

@media (max-width: 767px) {
    .chat-container {
        padding: 0 16px;
    }

    .greeting-container {
        padding-left: 18px !important;
        padding-right: 18px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .greeting span {
        font-size: clamp(24px, 6vw, 36px);
    }

    .sub-greeting {
        font-size: clamp(14px, 3.6vw, 22px);
        margin-top: -4px;
    }

    .bottom-input-container {
        padding: 12px 16px;
    }

    .input-wrapper {
        max-width: 100%;
    }

    .input-wrapper input {
        font-size: 15px;
    }

    #mode-sub-popup {
        min-width: 110px;
    }

    #skills-sub-popup {
        min-width: 90px;
    }

    .pin-popup {
        min-width: 140px;
        padding: 5px;
    }

    .pin-popup-item {
        padding: 7px 11px;
        font-size: 12px;
        gap: 8px;
    }

    .pin-popup-item i {
        font-size: 11px;
        width: 15px;
    }

    .tools-popup {
        width: min(94vw, 380px);
        max-width: 360px;
        padding: 18px 16px;
    }

    .tools-title {
        font-size: 16px;
    }

    .tools-list {
        gap: 8px;
    }

    .tool-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .tool-card span {
        font-size: 12px;
    }

    .tool-icon {
        width: 28px;
        height: 28px;
    }

    .tool-icon i {
        font-size: 13px;
    }

    .drive-popup {
        max-width: 200px;
        width: 92%;
        padding: 24px 18px 18px;
    }

    .drive-logo {
        width: 48px;
        height: 48px;
        margin-bottom: 14px;
    }

    .drive-logo i {
        font-size: 24px;
    }

    .drive-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .drive-desc {
        font-size: 12px;
        margin-bottom: 16px;
    }

    .drive-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .image-showcase {
        max-width: 340px;
        gap: 12px 16px;
        margin: 20px auto 0;
    }

    .group-images {
        width: 140px;
    }

    .group-images img {
        width: 32px;
        height: 32px;
    }

    .vid-thumb {
        width: 32px;
        height: 32px;
    }

    .vid-thumb i {
        font-size: 10px;
    }

    .group-title {
        font-size: 11px;
    }

    .active-mode-badge {
        padding: 3px 10px;
    }

    .active-mode-badge span {
        font-size: 12px;
    }

    .active-mode-badge i {
        font-size: 12px;
    }

    .disclaimer {
        font-size: 11px;
        margin-top: 12px;
    }

    .sound-btn,
    .mic-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .add-btn {
        font-size: 13px;
        width: 40px;
        height: 40px;
    }

    .floating-popup {
        padding: 5px;
        gap: 2px;
    }

    .popup-item {
        padding: 6px 9px;
        gap: 6px;
        border-radius: 9px;
    }

    .popup-item span {
        font-size: 11px;
    }

    .popup-item i {
        font-size: 13px;
        width: 19px;
    }

    .sub-popup {
        padding: 5px;
        gap: 2px;
    }

    .sub-popup .popup-item {
        padding: 5px 7px;
        gap: 5px;
    }

    .mode-s-icon {
        width: 21px;
        height: 21px;
    }

    .mode-s-icon i {
        font-size: 11px;
    }
}

@media (max-width: 479px) {
    .chat-container {
        padding: 0 12px;
    }

    .greeting span {
        font-size: clamp(20px, 7vw, 26px);
    }

    .sub-greeting {
        font-size: clamp(12px, 4.2vw, 16px);
        margin-top: -2px;
    }

    .bottom-input-container {
        padding: 8px 12px;
    }

    .input-wrapper {
        padding: 6px 10px;
    }

    .input-wrapper input {
        font-size: 14px;
        padding: 8px 10px;
    }

    .sound-btn,
    .mic-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .add-btn {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }

    .send-btn {
        width: 24px;
        height: 24px;
    }

    .send-btn.loading {
        width: 24px;
        height: 24px;
        right: 4px;
    }

    .image-showcase {
        max-width: 100%;
        gap: 10px 12px;
    }

    .group-images {
        width: 120px;
        gap: 3px;
    }

    .group-images img {
        width: 28px;
        height: 28px;
        border-radius: 4px;
    }

    .vid-thumb {
        width: 28px;
        height: 28px;
    }

    .vid-thumb i {
        font-size: 8px;
    }

    .group-title {
        font-size: 10px;
    }

    .library-sidebar .text {
        font-size: 12px;
    }

    .floating-popup {
        padding: 4px;
        gap: 2px;
    }

    .popup-item {
        padding: 5px 7px;
        gap: 5px;
        border-radius: 7px;
    }

    #mode-sub-popup {
        min-width: 110px;
    }

    #skills-sub-popup {
        min-width: 90px;
    }

    .popup-item span {
        font-size: 10px;
    }

    .popup-item i {
        font-size: 12px;
        width: 17px;
    }

    .sub-popup {
        padding: 4px;
        gap: 2px;
    }

    .sub-popup .popup-item {
        padding: 4px 7px;
        gap: 5px;
    }

    .mode-s-icon {
        width: 19px;
        height: 19px;
    }

    .mode-s-icon i {
        font-size: 10px;
    }

    .pin-popup {
        min-width: 130px;
        padding: 4px;
        border-radius: 12px;
    }

    .pin-popup-item {
        padding: 6px 10px;
        font-size: 12px;
        gap: 8px;
    }

    .pin-popup-item i {
        font-size: 11px;
        width: 14px;
    }

    .drive-popup {
        max-width: 160px;
        width: 94%;
        padding: 16px 12px 14px;
        border-radius: 16px;
    }

    .drive-logo {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .drive-logo i {
        font-size: 20px;
    }

    .drive-title {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .drive-desc {
        font-size: 11px;
        margin-bottom: 14px;
    }

    .drive-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .tools-popup {
        width: min(96vw, 350px);
        max-width: 350px;
        padding: 16px 12px;
        border-radius: 16px;
    }

    .tools-title {
        font-size: 15px;
    }

    .tools-list {
        gap: 8px;
    }

    .tool-card {
        padding: 9px 10px;
        gap: 8px;
    }

    .tool-card span {
        font-size: 11.5px;
    }

    .tool-icon {
        width: 26px;
        height: 26px;
    }

    .tool-icon i {
        font-size: 12px;
    }

    .active-mode-badge {
        padding: 2px 8px;
        gap: 4px;
    }

    .active-mode-badge span {
        font-size: 11px;
    }

    .active-mode-badge i {
        font-size: 11px;
    }

    .disclaimer {
        font-size: 10px;
        margin-top: 8px;
    }

    .sound-btn.slide-left,
    .mic-btn.slide-left {
        transform: translateX(-30px);
    }

    .drive-actions {
        gap: 8px;
    }
}

/* ========================================= */
/* CAMERA POPUP — Ultra Premium Acrylic */
/* ========================================= */
.camera-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(28px) saturate(1.15);
    -webkit-backdrop-filter: blur(28px) saturate(1.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.camera-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* =============================================
   POPUP — Layered Frosted Panel + Beveled Edge
   ============================================= */
.camera-popup {
    background: rgba(18, 18, 24, 0.6);
    backdrop-filter: blur(55px) saturate(1.7);
    -webkit-backdrop-filter: blur(55px) saturate(1.7);
    border-radius: 26px;
    max-width: 248px;
    width: 80%;
    overflow: hidden;
    position: relative;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 0 2px rgba(160, 100, 255, 0.015),
        0 0 80px rgba(160, 100, 255, 0.025),
        0 0 160px rgba(160, 100, 255, 0.01),
        0 28px 120px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

/* Gradient border overlay — animated */
.camera-popup::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 27px;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(160, 100, 255, 0.1) 0%,
            rgba(160, 100, 255, 0.02) 20%,
            rgba(255, 255, 255, 0.005) 40%,
            rgba(160, 100, 255, 0.03) 60%,
            rgba(100, 60, 220, 0.06) 80%,
            rgba(160, 100, 255, 0.08) 100%);
    background-size: 200% 200%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: cameraBorderShift 6s ease-in-out infinite;
}

@keyframes cameraBorderShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Ambient light reflections */
.camera-popup::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 26px;
    background:
        radial-gradient(ellipse 120px 80px at 20% 8%, rgba(160, 100, 255, 0.04) 0%, transparent 100%),
        radial-gradient(ellipse 100px 60px at 85% 92%, rgba(255, 255, 255, 0.02) 0%, transparent 100%),
        radial-gradient(ellipse 60px 40px at 70% 15%, rgba(255, 255, 255, 0.01) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* Subtle glass grain texture */
.camera-popup .camera-glass-grain {
    position: absolute;
    inset: 0;
    border-radius: 26px;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: overlay;
}

.camera-overlay.show .camera-popup {
    animation: cameraSpringPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.camera-overlay:not(.show) .camera-popup {
    animation: cameraFadeOut 0.35s ease forwards;
}

@keyframes cameraSpringPop {
    0% {
        transform: scale(0) translateY(12px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes cameraFadeOut {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }

    100% {
        transform: scale(0.82) translateY(12px);
        opacity: 0;
    }
}

[data-theme="light"] .camera-popup {
    background: rgba(255, 255, 255, 0.48);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.035),
        0 0 0 2px rgba(124, 77, 255, 0.01),
        0 0 60px rgba(124, 77, 255, 0.015),
        0 28px 120px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

[data-theme="light"] .camera-popup::before {
    background: linear-gradient(135deg,
            rgba(124, 77, 255, 0.06) 0%,
            rgba(124, 77, 255, 0.01) 20%,
            rgba(0, 0, 0, 0.005) 40%,
            rgba(124, 77, 255, 0.02) 60%,
            rgba(80, 50, 200, 0.04) 80%,
            rgba(124, 77, 255, 0.05) 100%);
}

/* bring child content above pseudo elements */
.camera-popup>*:not(.camera-popup::before):not(.camera-popup::after):not(.camera-glass-grain) {
    position: relative;
    z-index: 1;
}

/* =============================================
   HEADER — Minimalist Frosted
   ============================================= */
.camera-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    background: rgba(255, 255, 255, 0.008);
}

[data-theme="light"] .camera-header {
    border-bottom-color: rgba(0, 0, 0, 0.025);
    background: rgba(0, 0, 0, 0.004);
}

.camera-title {
    font-size: 13px;
    font-weight: 550;
    letter-spacing: -0.1px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}

.camera-title i {
    color: rgba(160, 100, 255, 0.45);
    font-size: 10.5px;
}

[data-theme="light"] .camera-title i {
    color: rgba(124, 77, 255, 0.35);
}

.camera-close {
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.015);
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.camera-close:hover {
    background: rgba(160, 100, 255, 0.06);
    color: rgba(160, 100, 255, 0.7);
    transform: rotate(90deg) scale(1.05);
    border-color: rgba(160, 100, 255, 0.05);
    box-shadow: 0 0 12px rgba(160, 100, 255, 0.02);
}

[data-theme="light"] .camera-close {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .camera-close:hover {
    background: rgba(124, 77, 255, 0.04);
    color: rgba(124, 77, 255, 0.6);
    border-color: rgba(124, 77, 255, 0.04);
}

/* =============================================
   VIEWPORT — Rounded + Inset Depth
   ============================================= */
.camera-view {
    position: relative;
    width: calc(100% - 10px);
    margin: 5px auto 0;
    aspect-ratio: 4 / 3;
    background: #000;
    overflow: hidden;
    border-radius: 14px;
    box-shadow:
        inset 0 0 40px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.camera-view::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.015);
    pointer-events: none;
    z-index: 2;
}

.camera-view video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 14px;
}

.camera-view.mirrored video {
    transform: scaleX(-1);
}

/* placeholder */
.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.08);
    font-size: 10.5px;
    background: radial-gradient(ellipse at 30% 30%, rgba(60, 30, 120, 0.15), #060608);
    border-radius: 14px;
}

.camera-placeholder i {
    font-size: 26px;
    opacity: 0.18;
    animation: camPlaceholderFloat 4s ease-in-out infinite;
}

@keyframes camPlaceholderFloat {

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

    50% {
        transform: translateY(-3px);
        opacity: 0.3;
    }
}

/* =============================================
   ACTIONS BAR — Glass Panel
   ============================================= */
.camera-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 9px 14px 11px;
    background: rgba(255, 255, 255, 0.008);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .camera-actions {
    border-top-color: rgba(0, 0, 0, 0.02);
    background: rgba(0, 0, 0, 0.004);
}

/* base button */
.cam-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    outline: none;
}

.cam-btn:focus-visible {
    box-shadow: 0 0 0 2px rgba(160, 100, 255, 0.15);
}

.cam-btn:hover {
    transform: scale(1.05);
}

.cam-btn:active {
    transform: scale(0.9);
}

/* =============================================
   SWITCH — Minimal Glass
   ============================================= */
.switch-cam-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    overflow: hidden;
}

.switch-cam-btn:hover {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.switch-cam-btn i {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}

.switch-cam-btn:hover i {
    transform: rotate(180deg) scale(1.1);
}

[data-theme="light"] .switch-cam-btn {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .switch-cam-btn:hover {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.6);
}

/* =============================================
   CAPTURE — Minimal Luminous Red
   ============================================= */
.capture-cam-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 17px;
    color: rgba(255, 255, 255, 0.5);
    position: relative;
    background: transparent;
    border: 1px solid rgba(255, 80, 80, 0.1);
    box-shadow:
        0 0 0 2px rgba(255, 80, 80, 0.015),
        0 0 18px rgba(255, 80, 80, 0.02);
    animation: capturePulse 3s ease-in-out infinite;
}

.capture-cam-btn:hover {
    transform: scale(1.06);
    background: transparent;
    border-color: rgba(255, 60, 60, 0.25);
    color: #FF5C5C;
    box-shadow:
        0 0 0 3px rgba(255, 80, 80, 0.03),
        0 0 0 7px rgba(255, 80, 80, 0.015),
        0 0 28px rgba(255, 60, 60, 0.04);
}

.capture-cam-btn:active {
    transform: scale(0.88);
    border-color: rgba(200, 30, 30, 0.35);
    color: #FF4444;
    box-shadow:
        0 0 0 5px rgba(255, 60, 60, 0.025),
        0 0 0 10px rgba(200, 30, 30, 0.01),
        0 0 40px rgba(200, 30, 30, 0.05);
    transition-duration: 0.1s;
}

.capture-cam-btn i {
    transition: transform 0.15s ease;
    position: relative;
    z-index: 1;
}

.capture-cam-btn:active i {
    transform: scale(0.8);
}

@keyframes capturePulse {

    0%,
    100% {
        box-shadow:
            0 0 0 2px rgba(255, 80, 80, 0.015),
            0 0 18px rgba(255, 80, 80, 0.02);
    }

    50% {
        box-shadow:
            0 0 0 4px rgba(255, 80, 80, 0.025),
            0 0 28px rgba(255, 60, 60, 0.035),
            0 0 48px rgba(255, 60, 60, 0.01);
    }
}

[data-theme="light"] .capture-cam-btn {
    background: transparent;
    border-color: rgba(220, 50, 50, 0.08);
    color: rgba(220, 50, 50, 0.4);
    box-shadow:
        0 0 0 2px rgba(220, 50, 50, 0.01),
        0 0 18px rgba(220, 50, 50, 0.01);
}

[data-theme="light"] .capture-cam-btn:hover {
    background: transparent;
    border-color: rgba(220, 50, 50, 0.18);
    color: #D32F2F;
    box-shadow:
        0 0 0 3px rgba(220, 50, 50, 0.02),
        0 0 0 7px rgba(220, 50, 50, 0.008),
        0 0 28px rgba(220, 50, 50, 0.02);
}

/* =============================================
   FLASH — Violet-to-Blue Radial Burst
   ============================================= */
.camera-flash {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: radial-gradient(circle at center,
            rgba(200, 160, 255, 0.25) 0%,
            rgba(120, 80, 255, 0.15) 20%,
            rgba(60, 100, 255, 0.05) 50%,
            transparent 75%);
    opacity: 0;
    pointer-events: none;
    z-index: 3;
}

.camera-flash.active {
    animation: cameraFlashBang 0.45s ease forwards;
}

@keyframes cameraFlashBang {
    0% {
        opacity: 1;
        transform: scale(0.7);
    }

    25% {
        opacity: 1;
        transform: scale(1.08);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.15);
    }

    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 479px) {
    .camera-popup {
        max-width: 212px;
        border-radius: 22px;
    }

    .camera-popup::before {
        border-radius: 23px;
    }

    .camera-popup::after {
        border-radius: 22px;
    }

    .camera-popup .camera-glass-grain {
        border-radius: 22px;
    }

    .camera-view {
        border-radius: 12px;
    }

    .camera-view video {
        border-radius: 12px;
    }

    .camera-view::after {
        border-radius: 12px;
    }

    .camera-placeholder {
        border-radius: 12px;
    }

    .camera-flash {
        border-radius: 12px;
    }

    .camera-actions {
        gap: 18px;
        padding: 7px 10px 9px;
    }

    .cam-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
        border-radius: 7px;
    }

    .capture-cam-btn {
        width: 34px;
        height: 34px;
        font-size: 15px;
        border-radius: 10px;
    }
}


/* Shimmer loading skeleton */
.skeleton-loading {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.05) 75%) !important;
    background-size: 200% 100% !important;
    animation: shimmerPulse 1.5s infinite linear !important;
    color: transparent !important;
    border-radius: 4px;
}

.skeleton-loading * {
    visibility: hidden !important;
}

@keyframes shimmerPulse {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ========================================= */
/* NOX PERFECT GEMINI ALIGNMENT (FINAL)      */
/* ========================================= */

.input-main-row {
    align-items: flex-end !important;
    gap: 12px !important;
}

.input-content {
    flex: 1 !important;
    width: 100% !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

textarea#chat-input {
    width: 100% !important;
    text-align: left !important;
    padding: 14px 15px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    line-height: 1.5 !important;
    white-space: pre-wrap !important;
}

/* लेफ्ट आइकॉन (Infinity) और राइट आइकॉन्स ग्रुप का अलाइनमेंट */
#infinity-btn,
.btn-group {
    align-self: flex-end !important;
    /* FIX: 14px se ghata kar 10px kar diya hai. Taaki icons thoda niche khisak kar ekdam center me aa jayein. */
    margin-bottom: 10px !important;
}

.btn-group {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.icon-btn,
.btn-group .icon-btn {
    margin-bottom: 0 !important;
}

/* --- Stop Button (Send Button Loading State) Clickable & Hover Styling --- */
.send-btn.loading {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.send-btn.loading:hover {
    transform: translateY(-50%) scale(1.1) !important;
    background: linear-gradient(135deg, #ff3333, #b30000) !important;
    box-shadow: 0 0 14px rgba(255, 50, 50, 0.7), 0 0 30px rgba(255, 50, 50, 0.4) !important;
}

/* ============================================================
   MOBILE-ONLY PRECISE LAYOUT OVERRIDES (MAX-WIDTH: 767PX)
   ============================================================ */
@media (max-width: 767px) {

    /* 1 & 2. Fix Invisible Sidebar Footprint while preserving normal open state */
    .sidebar.collapsed {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 76px !important;
        height: 80px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        pointer-events: none !important;
        z-index: 1001 !important;
        overflow: visible !important;
    }

    .sidebar.collapsed #toggle-sidebar,
    .sidebar.collapsed .menu-btn {
        pointer-events: auto !important;
    }

    /* 3. Perfectly center the bottom chat box & ensure high stack order */
    .bottom-input-container {
        flex-shrink: 0 !important;
        position: relative !important;
        width: 100% !important;
        max-width: 600px !important;
        transform: none !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        box-sizing: border-box !important;
        z-index: 1010 !important;
        pointer-events: auto !important;
        margin: 0 !important;
    }

    .input-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    #infinity-btn {
        position: relative !important;
        z-index: 1011 !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* ==========================================================
       4. FLOATING POPUP — BRUTE-FORCE FIXED + DESKTOP AESTHETICS
       ========================================================== */

    /* Closed state: fully hidden, no layout impact */
    .floating-popup {
        position: fixed !important;
        opacity: 0 !important;
        pointer-events: none !important;
        z-index: 999999 !important;
        /* Dynamic anchor: above icon, safe-area aware */
        bottom: calc(125px + env(safe-area-inset-bottom)) !important;
        left: 15px !important;
        transform: none !important;
        /* Glassmorphism */
        background: rgba(30, 31, 32, 0.75) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        border: 1px solid rgba(255, 255, 255, 0.10) !important;
        border-radius: 0.875rem !important;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.50) !important;
        /* Intrinsic width: hug content exactly */
        display: flex !important;
        flex-direction: column !important;
        gap: 0.125rem !important;
        padding: 5px 4px !important;
        width: max-content !important;
        min-width: 0 !important;
        right: auto !important;
        white-space: nowrap !important;
        overflow: visible !important;
        transition: opacity 0.2s ease !important;
    }

    /* Open state: fade in and slide up */
    .floating-popup.show {
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
    }

    /* Light theme variant */
    [data-theme="light"] .floating-popup {
        background: rgba(240, 244, 249, 0.85) !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
    }

    /* --- Popup items: clean horizontal icon+text rows --- */
    .popup-item {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        width: max-content !important;
        min-width: 0 !important;
        gap: 0.5em !important;
        padding: 6px 8px !important;
        border-radius: 0.5rem !important;
        cursor: pointer !important;
        white-space: nowrap !important;
    }

    .popup-item i {
        font-size: 0.875rem !important;
        width: 1.15em !important;
        text-align: center !important;
        flex-shrink: 0 !important;
    }

    .popup-item span {
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        font-weight: 500 !important;
    }

    /* Ensure static positioning and touch events for sub-popup items on mobile so they anchor to container */
    #upload-item,
    #mode-item,
    #skills-item,
    .popup-item {
        position: static !important;
        pointer-events: auto !important;
    }

    /* Disable hover-based display on mobile */
    .popup-item:hover > .sub-popup {
        display: none !important;
    }

    /* Disable hover states on mobile to fix double-tap trigger issues */
    .popup-item:hover {
        background: transparent !important;
        color: var(--text-muted) !important;
    }
    .popup-item.active {
        background: var(--hover-color) !important;
        color: var(--text-main) !important;
    }
    .popup-item.active:hover {
        background: var(--hover-color) !important;
        color: var(--text-main) !important;
    }
    .sub-popup:hover {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    .active > .sub-popup:hover,
    #upload-item.active > .sub-popup:hover,
    #mode-item.active > .sub-popup:hover,
    #skills-item.active > .sub-popup:hover {
        display: flex !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Kill all inherited sub-popup min-widths */
    .sub-popup,
    #upload-item > .sub-popup,
    #mode-sub-popup,
    #skills-sub-popup {
        min-width: 0 !important;
        width: max-content !important;
    }

    /* ==========================================================
       SUB-POPUPS — DETACHED POSITIONING (MOBILE FLYOUT TO RIGHT)
       ========================================================== */
    .sub-popup {
        /* Completely removed from flow when closed — prevents width inflation */
        display: none !important;
        position: absolute !important;
        left: calc(100% + 8px) !important;
        top: auto !important;
        bottom: 0 !important;
        width: max-content !important;
        min-width: 0 !important;
        max-width: 45vw !important;
        margin: 0 !important;
        transform: none !important;
        pointer-events: none !important;
        z-index: 999999 !important;
        /* Glassmorphism matching primary popup */
        background: rgba(30, 31, 32, 0.75) !important;
        backdrop-filter: blur(24px) !important;
        -webkit-backdrop-filter: blur(24px) !important;
        border: 1px solid rgba(255, 255, 255, 0.10) !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
        padding: 0 !important;
        flex-direction: column !important;
        gap: 2px !important;
    }

    [data-theme="light"] .sub-popup {
        background: rgba(240, 244, 249, 0.85) !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
    }

    /* Active/expanded sub-popup */
    .active>.sub-popup,
    #upload-item.active>.sub-popup,
    #mode-item.active>.sub-popup,
    #skills-item.active>.sub-popup {
        display: flex !important;
        opacity: 1 !important;
        padding: 4px !important;
        pointer-events: auto !important;
    }

    /* Sub-popup items: slightly smaller for visual hierarchy */
    .sub-popup .popup-item {
        padding: 6px 10px !important;
        gap: 8px !important;
        border-radius: 8px !important;
        width: max-content !important;
    }

    .sub-popup .popup-item i {
        font-size: 13px !important;
        width: 18px !important;
    }

    .sub-popup .popup-item span {
        font-size: 12px !important;
    }

    /* Mode icons inside sub-popup */
    .mode-s-icon {
        width: 22px !important;
        height: 22px !important;
        border-radius: 6px !important;
    }

    .mode-s-icon i {
        font-size: 11px !important;
    }

    /* ==========================================================
       STRUCTURAL HEIGHT & SAFE-AREA FIXES (100dvh + env)
       ========================================================== */

    /* 1. Fix dynamic viewport height — prevents 100vh clipping behind mobile browser bars */
    body {
        height: 100dvh !important;
        height: calc(var(--vh, 1vh) * 100) !important;
        max-height: calc(var(--vh, 1vh) * 100) !important;
    }

    /* 2. Lift chat box & reveal disclaimer via safe-area bottom padding & prevent squashing */
    .main-content {
        width: 100% !important;
        flex: 1 1 0% !important;
        min-height: 0 !important;
        padding-bottom: calc(15px + env(safe-area-inset-bottom)) !important;
    }

    /* 3. Sidebar: overlay drawer style, z-index: 9999 */
    .sidebar:not(.collapsed) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        z-index: 9999 !important;
        width: 280px !important;
        display: flex !important;
        flex-direction: column !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        background: rgba(18, 18, 20, 0.75) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4) !important;
        border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
        pointer-events: auto !important;
    }

    [data-theme="light"] .sidebar:not(.collapsed) {
        background: rgba(255, 255, 255, 0.8) !important;
        border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    /* Mobile Search Overlay & Popup Rules */
    #search-overlay.show, .search-overlay.show {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.75) !important;
        backdrop-filter: blur(10px) !important;
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        padding-top: 80px !important;
        z-index: 99999 !important;
        pointer-events: auto !important;
        overflow-y: auto !important;
    }

    .search-popup {
        position: relative !important;
        top: 0 !important;
        left: auto !important;
        transform: none !important;
        margin: 0 auto !important;
        width: 92% !important;
        max-width: 380px !important;
        max-height: 55vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ============================================================
   TARGETED MOBILE-ONLY NEW CHAT BUTTON FIX (MAX-WIDTH: 768PX)
   ============================================================ */
@media (max-width: 768px) {
    /* Pure mobile-only box-model neutralization to align new-chat-btn perfectly */
    .sidebar.collapsed .new-chat-btn,
    .sidebar:not(.collapsed) .new-chat-btn {
        margin: 0px !important;
        padding: 6px !important;
        position: relative !important;
        left: 0px !important;
        top: 0px !important;
        transform: none !important;
    }
}

/* ============================================================
   DESKTOP/LARGE SCREEN LAYOUT OPTIMIZATIONS (MIN-WIDTH: 769PX)
   ============================================================ */
@media (min-width: 769px) {
    /* 1. Pull bottom input container down and add spacing */
    .bottom-input-container {
        position: sticky !important;
        bottom: 0 !important;
        width: 100% !important;
        z-index: 10 !important;
        background: transparent !important;
        margin-bottom: 0 !important;
        padding-bottom: 12px !important;
        padding-top: 10px !important;
        padding-left: 24px !important;
        padding-right: 24px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* 2. Set exact spacing and static flow for disclaimer */
    .disclaimer {
        margin-top: 8px !important;
        position: relative !important;
        transform: translateY(-8px) !important;
        z-index: 20 !important;
    }

    /* 3. Keep chat messages from being squashed */
    .chat-messages {
        padding-bottom: 100px !important;
        flex-grow: 1 !important;
        height: auto !important;
    }

    .chat-container {
        flex-grow: 1 !important;
        height: auto !important;
    }

    /* 4. Optimize Chat Bubble Widths for Desktop */
    .message-text {
        max-width: 80% !important;
    }
}

/* ============================================================
   MASTER FRONTEND UI: BORDERLESS FLOATING TYPOGRAPHY & THEME SYNC
   ============================================================ */
.thinking-indicator-pill,
.thinking-indicator-pill *,
div.thinking-indicator-pill {
    background: transparent !important;
    background-color: transparent !important;
    border: 0 !important;
    border-style: none !important;
    outline: none !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

.thinking-indicator-pill {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 9px !important;
    padding: 6px 0px !important;
    margin-bottom: 12px !important;
    margin-top: 4px !important;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    align-self: flex-start !important;
}

.thinking-indicator-pill.fading-out {
    opacity: 0 !important;
    transform: translateY(-4px) scale(0.98) !important;
    pointer-events: none !important;
}

/* ============================================================
   CHATGPT/CLAUDE-STYLE DYNAMIC CONTEXTUAL TOOL ICONS
   ============================================================ */
.thinking-tool-icon-wrap {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease !important;
}

.thinking-tool-icon-wrap.icon-transition {
    transform: scale(0.65) rotate(-10deg) !important;
    opacity: 0.25 !important;
}

.thinking-tool-icon {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
    stroke-width: 2 !important;
    flex-shrink: 0 !important;
}

.thinking-icon-search {
    color: #38bdf8 !important; /* Sky blue */
    animation: toolIconPulse 2.2s ease-in-out infinite !important;
}

.thinking-icon-drive {
    color: #34d399 !important; /* Emerald green */
    animation: toolIconPulse 2.2s ease-in-out infinite !important;
}

.thinking-icon-code {
    color: #a78bfa !important; /* Violet */
    animation: toolIconPulse 2s ease-in-out infinite !important;
}

.thinking-icon-math {
    color: #fbbf24 !important; /* Amber gold */
    animation: toolIconPulse 2.2s ease-in-out infinite !important;
}

.thinking-icon-doc {
    color: #f472b6 !important; /* Pink / Rose */
    animation: toolIconPulse 2s ease-in-out infinite !important;
}

.thinking-icon-sparkle,
.thinking-icon-cpu {
    color: #818cf8 !important; /* Indigo */
    animation: toolIconPulse 2.2s ease-in-out infinite !important;
}

.thinking-icon-image {
    color: #2dd4bf !important; /* Teal */
    animation: toolIconPulse 2.2s ease-in-out infinite !important;
}

@keyframes toolIconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.88;
    }
    50% {
        transform: scale(1.14);
        opacity: 1;
        filter: drop-shadow(0 0 5px currentColor);
    }
}

@keyframes toolIconSpin {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 0.88;
    }
    50% {
        transform: rotate(12deg) scale(1.12);
        opacity: 1;
        filter: drop-shadow(0 0 5px currentColor);
    }
}

.thinking-pulse-dots {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.thinking-pulse-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    display: inline-block !important;
    animation: thinkingPulse 1.4s infinite ease-in-out both !important;
}

:root[data-theme="dark"] .thinking-pulse-dot {
    background-color: #818cf8 !important;
}

:root[data-theme="light"] .thinking-pulse-dot {
    background-color: #4f46e5 !important;
}

.thinking-pulse-dot:nth-child(1) { animation-delay: -0.32s !important; }
.thinking-pulse-dot:nth-child(2) { animation-delay: -0.16s !important; }
.thinking-pulse-dot:nth-child(3) { animation-delay: 0s !important; }

@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.35;
    }
    40% {
        transform: scale(1.15);
        opacity: 1;
    }
}

.thinking-text {
    font-size: 0.92rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.2px !important;
    transition: opacity 0.2s ease !important;
}

:root[data-theme="dark"] .thinking-text {
    background: linear-gradient(90deg, #ffffff, #c7d2fe, #818cf8) !important;
    background-size: 200% auto !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    animation: textShimmer 3s linear infinite !important;
}

:root[data-theme="light"] .thinking-text {
    background: linear-gradient(90deg, #1e1b4b, #3730a3, #4f46e5) !important;
    background-size: 200% auto !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    animation: textShimmer 3s linear infinite !important;
}

@keyframes textShimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.message.ai.thinking-mode {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.message.ai.thinking-mode .message-text {
    display: none !important;
}

/* ============================================================
   GEMINI-STYLE COMPACT 1X CONTINUOUS MARQUEE SLIDING SOURCE ICONS
   ============================================================ */
.search-source-icons {
    display: inline-flex !important;
    align-items: center !important;
    margin-left: 6px !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
    max-width: 130px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    mask-image: linear-gradient(to right, transparent, black 8px, black calc(100% - 8px), transparent) !important;
    -webkit-mask-image: linear-gradient(to right, transparent, black 8px, black calc(100% - 8px), transparent) !important;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    align-self: center !important;
}

.search-source-track {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    width: max-content !important;
}

.search-source-track.marquee-animated {
    animation: faviconMarquee 7s linear infinite !important;
}

@keyframes faviconMarquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.thinking-indicator-pill.fading-out,
.search-source-icons.fading-out {
    opacity: 0 !important;
    transform: translateY(-6px) scale(0.96) !important;
    pointer-events: none !important;
}

.source-icon-badge {
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    opacity: 0;
    transform: scale(0.7);
    animation: sourceBadgePopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
    animation-delay: calc(var(--i, 0) * 0.06s) !important;
}

@keyframes sourceBadgePopIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

:root[data-theme="dark"] .source-icon-badge {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}

:root[data-theme="light"] .source-icon-badge {
    background: rgba(0, 0, 0, 0.06) !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08) !important;
}

.source-icon-badge img {
    width: 12px !important;
    height: 12px !important;
    object-fit: contain !important;
    border-radius: 1px !important;
}

/* ============================================================
   CHATGPT / GEMINI STYLE MULTI-STEP PROGRESSIVE CAPSULE
   ============================================================ */
.thinking-step-capsule {
    display: flex !important;
    flex-direction: column !important;
    align-self: flex-start !important;
    margin-top: 4px !important;
    margin-bottom: 12px !important;
    max-width: 100% !important;
    min-width: 0 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* In-Place Active Transitional State (Borderless floating text + icon during streaming) */
.thinking-active-pill {
    display: none;
    align-items: center !important;
    gap: 6px !important;
    padding: 3px 0 !important;
    border-radius: 0 !important;
    user-select: none !important;
    font-size: 0.86rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.15px !important;
    width: fit-content !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transition: color 0.2s ease !important;
}

:root[data-theme="dark"] .thinking-active-pill {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #cbd5e1 !important;
}

:root[data-theme="light"] .thinking-active-pill {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #475569 !important;
}

/* Streaming state visibility: Show active pill, strictly hide header and steps list */
.thinking-step-capsule.is-streaming .thinking-active-pill {
    display: inline-flex !important;
}

.thinking-step-capsule.is-streaming .thinking-capsule-header {
    display: none !important;
}

.thinking-step-capsule.is-streaming .thinking-steps-list {
    display: none !important;
}

.active-pill-icon-wrap {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.active-pill-label-text {
    display: inline-block !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    transition: opacity 0.12s cubic-bezier(0.4, 0, 0.2, 1), transform 0.12s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.active-pill-pulse-dots {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    margin-left: 2px !important;
    flex-shrink: 0 !important;
}

.thinking-pulse-dot {
    width: 3.5px !important;
    height: 3.5px !important;
    border-radius: 50% !important;
    display: inline-block !important;
    animation: thinkingDotPulse 1.4s infinite ease-in-out !important;
}

:root[data-theme="dark"] .thinking-pulse-dot {
    background: rgba(255, 255, 255, 0.55) !important;
}

:root[data-theme="light"] .thinking-pulse-dot {
    background: rgba(0, 0, 0, 0.45) !important;
}

.active-pill-pulse-dots .thinking-pulse-dot:nth-child(1) {
    animation-delay: 0s !important;
}
.active-pill-pulse-dots .thinking-pulse-dot:nth-child(2) {
    animation-delay: 0.2s !important;
}
.active-pill-pulse-dots .thinking-pulse-dot:nth-child(3) {
    animation-delay: 0.4s !important;
}

@keyframes thinkingDotPulse {
    0%, 80%, 100% {
        opacity: 0.25;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Disclosure Header (collapsed / completed state) */
.thinking-capsule-header {
    display: none;
    align-items: center !important;
    gap: 7px !important;
    padding: 5px 12px !important;
    border-radius: 9999px !important;
    cursor: pointer !important;
    user-select: none !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.2px !important;
    width: fit-content !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    outline: none !important;
}

:root[data-theme="dark"] .thinking-capsule-header {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    color: rgba(255, 255, 255, 0.72) !important;
}

:root[data-theme="dark"] .thinking-capsule-header:hover {
    background: rgba(255, 255, 255, 0.09) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
}

:root[data-theme="light"] .thinking-capsule-header {
    background: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: rgba(0, 0, 0, 0.65) !important;
}

:root[data-theme="light"] .thinking-capsule-header:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    color: #0f172a !important;
}

.thinking-step-capsule.collapsed .thinking-capsule-header,
.thinking-step-capsule.expanded .thinking-capsule-header {
    display: inline-flex !important;
}

.thinking-step-capsule.collapsed .thinking-active-pill,
.thinking-step-capsule.expanded .thinking-active-pill {
    display: none !important;
}

.thinking-header-chevron {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.thinking-step-capsule.collapsed .thinking-header-chevron {
    transform: rotate(-90deg) !important;
}

.thinking-step-capsule.expanded .thinking-header-chevron {
    transform: rotate(0deg) !important;
}

.thinking-header-count {
    opacity: 0.6 !important;
    font-size: 0.76rem !important;
    margin-left: 2px !important;
}

/* Progressive Steps List */
.thinking-steps-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 9px !important;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.25s ease !important;
}

.thinking-step-capsule.collapsed .thinking-steps-list {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    margin-top: 0 !important;
    padding: 0 !important;
}

.thinking-step-capsule.expanded .thinking-steps-list {
    max-height: min(800px, 60vh) !important;
    opacity: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    pointer-events: auto !important;
    margin-top: 10px !important;
    padding-right: 4px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
}

/* Custom Sleek Scrollbar for Thinking Steps List */
.thinking-steps-list::-webkit-scrollbar {
    width: 4px !important;
}

.thinking-steps-list::-webkit-scrollbar-track {
    background: transparent !important;
}

.thinking-steps-list::-webkit-scrollbar-thumb {
    border-radius: 4px !important;
    transition: background 0.2s ease !important;
}

:root[data-theme="dark"] .thinking-steps-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16) !important;
}

:root[data-theme="dark"] .thinking-steps-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}

:root[data-theme="light"] .thinking-steps-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.16) !important;
}

:root[data-theme="light"] .thinking-steps-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28) !important;
}

:root[data-theme="dark"] .thinking-steps-list {
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent !important;
}

:root[data-theme="light"] .thinking-steps-list {
    scrollbar-color: rgba(0, 0, 0, 0.16) transparent !important;
}

/* Step Row Layout */
.thinking-step-row {
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    opacity: 0;
    transform: translateY(6px);
    animation: stepSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes stepSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-icon-col {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
}

.step-label-col {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 7px !important;
    max-width: calc(100% - 29px) !important;
    min-width: 0 !important;
}

.step-label-text {
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.15px !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    transition: color 0.2s ease !important;
}

:root[data-theme="dark"] .thinking-step-row.is-running .step-label-text {
    color: #e2e8f0 !important;
}

:root[data-theme="dark"] .thinking-step-row.is-completed .step-label-text {
    color: rgba(255, 255, 255, 0.55) !important;
}

:root[data-theme="light"] .thinking-step-row.is-running .step-label-text {
    color: #1e293b !important;
}

:root[data-theme="light"] .thinking-step-row.is-completed .step-label-text {
    color: rgba(0, 0, 0, 0.5) !important;
}

.step-status-col {
    display: inline-flex !important;
    align-items: center !important;
}

/* Subtle Emerald Checkmark for Completed Step */
.step-check-svg {
    color: #10b981 !important;
    width: 15px !important;
    height: 15px !important;
    stroke-width: 2.5 !important;
    animation: checkPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes checkPop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- NOX MARKDOWN STYLING ENGINE --- */
.message-text-content h1,
.message-text-content h2,
.message-text-content h3,
.message-text-content h4,
.message-text-content h5,
.message-text-content h6 {
    margin-top: 0.8rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-main);
}

.message-text-content h1 { font-size: 1.25rem; }
.message-text-content h2 { font-size: 1.15rem; }
.message-text-content h3 { font-size: 1.05rem; }
.message-text-content h4 { font-size: 1.00rem; }
.message-text-content h5 { font-size: 0.95rem; }
.message-text-content h6 { font-size: 0.90rem; }

.message-text-content strong {
    font-weight: 600;
    color: var(--text-main);
}

.message-text-content .inline-code {
    background: rgba(255, 255, 255, 0.1);
    color: #f59e0b;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

:root[data-theme="light"] .message-text-content .inline-code {
    background: rgba(0, 0, 0, 0.06);
    color: #d97706;
}

.nox-markdown-list {
    margin: 0.5rem 0 0.5rem 1.2rem;
    padding-left: 0.2rem;
    list-style-type: disc;
}

.nox-markdown-list li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    display: block !important;
    box-sizing: border-box !important;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.nox-markdown-table {
    width: 100% !important;
    min-width: 520px !important;
    table-layout: auto !important;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.nox-markdown-table th,
.nox-markdown-table td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--glass-border);
    min-width: 130px !important;
    max-width: 320px !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

.nox-markdown-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

:root[data-theme="light"] .nox-markdown-table th {
    background: rgba(0, 0, 0, 0.04);
}

/* Custom Webkit Scrollbar for Table Wrapper */
.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.35);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.65);
}

.nox-markdown-quote {
    border-left: 3px solid #f59e0b;
    margin: 0.6rem 0;
    padding: 0.4rem 0.8rem;
    background: rgba(245, 158, 11, 0.08);
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

/* Document Chip in Chat Bubble */
.msg-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    margin-bottom: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 100%;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.msg-doc-chip:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
}
.msg-doc-chip-icon {
    font-size: 20px;
    color: #60a5fa;
    flex-shrink: 0;
}
.msg-doc-chip-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.msg-doc-chip-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}
.msg-doc-chip-meta {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   NOX VISUAL INTELLIGENCE V3 — STUDY IMAGE, DIAGRAM & STREAMING STYLES
   ========================================================================== */

/* --- 1. Study Image Surface --- */
/* --- Message Dedicated Slot Architecture --- */
.message-visual-slot {
    width: 100%;
    display: block;
}

.message-text-slot {
    width: 100%;
    display: block;
}

/* --- 1. Study Image Surface (Compact Responsive Reference Panel) --- */
.study-image-surface {
    display: grid;
    gap: 8px;
    margin: 6px 0 14px 0;
    width: 100%;
    max-width: 420px;
    animation: studySurfaceFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.study-image-surface[data-count="1"] {
    grid-template-columns: minmax(0, 1fr);
    max-width: 260px;
}

.study-image-surface[data-count="2"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 420px;
}

.study-image-surface[data-count="3"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 540px;
}

.study-image-surface[data-count="4"],
.study-image-surface[data-count="5"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 420px;
}

/* Tablet sizing */
@media (max-width: 820px) {
    .study-image-surface {
        max-width: 100%;
        gap: 8px;
    }
    .study-image-surface[data-count="3"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Mobile compact 2-column grid (fits 2 images side-by-side cleanly without horizontal scroll) */
@media (max-width: 640px) {
    .study-image-surface {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: visible !important;
        padding-bottom: 0 !important;
    }
    .study-image-surface[data-count="1"] {
        grid-template-columns: minmax(0, 1fr) !important;
        max-width: 220px !important;
    }
    .study-image-tile {
        flex: unset !important;
        aspect-ratio: 16 / 10 !important;
        max-height: 105px !important;
        border-radius: 8px !important;
    }
    .study-image-badge {
        bottom: 4px !important;
        left: 4px !important;
        right: 4px !important;
        padding: 2.5px 5px !important;
        border-radius: 5px !important;
    }
    .study-image-caption {
        font-size: 9.5px !important;
    }
    .study-image-source {
        font-size: 7.5px !important;
    }
}

/* --- 2. Study Image Tile --- */
.study-image-tile {
    position: relative;
    aspect-ratio: 16 / 10;
    max-height: 125px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: zoom-in;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.study-image-tile:hover {
    transform: translateY(-1.5px) scale(1.01);
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 8px 18px -3px rgba(0, 0, 0, 0.45);
}

.study-image-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.study-image-tile img.loaded {
    opacity: 1;
}

/* Skeleton Shimmer */
.study-image-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 100%);
    background-size: 200% 100%;
    animation: studySkeletonShimmer 1.5s infinite;
    pointer-events: none;
}

@keyframes studySkeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.study-image-tile img.loaded + .study-image-skeleton {
    display: none;
}

/* Badge overlay */
.study-image-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.study-image-caption {
    font-size: 10.5px;
    font-weight: 500;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.study-image-source {
    font-size: 8.5px;
    font-weight: 600;
    text-transform: uppercase;
    color: #fbbf24;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* --- 3. Study Diagram Surface (Mermaid SVG) --- */
.study-diagram-surface {
    margin: 14px 0;
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.09);
    overflow-x: auto;
    text-align: center;
    transition: border-color 0.2s ease;
}

.study-diagram-surface:hover {
    border-color: rgba(245, 158, 11, 0.3);
}

.study-diagram-surface svg {
    max-width: 100% !important;
    height: auto !important;
    display: inline-block;
}

.study-diagram-surface.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    color: var(--text-muted, #94a3b8);
    font-size: 13px;
}

.study-diagram-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(245, 158, 11, 0.2);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: studyDiagramSpin 0.8s linear infinite;
}

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

/* --- 4. Stable Streaming Code Block --- */
.code-block.streaming {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    will-change: auto !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #0d0f14 !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    position: relative;
}

/* ========================================================
   ULTIMATE UNIFIED CODE SCROLL ARCHITECTURE (IDE-GRADE)
   ======================================================== */

/* 1. Parent body: The ONLY scroll container in the entire block */
.code-block .code-body,
.code-block.streaming .code-body {
    display: flex !important;
    flex-direction: row !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    max-height: 480px !important;
    overflow-x: auto !important;         /* Pinned to actual bottom of box */
    overflow-y: auto !important;         /* Unified 1:1 vertical scroll */
    align-items: stretch !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* 2. Line Numbers Gutter: Clean, borderless, unified flat scroll */
.code-block .code-lines,
.code-block.streaming .code-lines {
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    user-select: none !important;
    border: none !important;
    border-right: none !important;
    box-shadow: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible !important;
    height: auto !important;
}

/* 3. Code Surface: Zero internal overflow, border cleanup, natural expansion */
.code-block .code-stream-pre,
.code-block.streaming .code-stream-pre,
.code-block .code-content,
.code-block .code-content pre {
    margin: 0 !important;
    margin-left: 0 !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
    border-left: none !important;
    box-shadow: none !important;
    flex: 1 0 auto !important;           /* Allows width to expand to longest code line */
    min-width: calc(100% - 44px) !important;
    box-sizing: border-box !important;
    overflow: visible !important;        /* CRITICAL: Disables nested scrollport completely */
    height: auto !important;             /* Natural content height matching line numbers */
    min-height: auto !important;
    color: rgba(255, 255, 255, 0.88) !important;
    white-space: pre !important;
    background: transparent !important;
    border: none !important;
}

/* Force Block Context on Inner Code Element (Eliminates Vertical Shift) */
.code-block .code-stream-pre code,
.code-block.streaming .code-stream-body,
.code-block .code-content pre code {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 24px !important;
    min-height: 24px !important;
    box-sizing: border-box !important;
}

/* 4. Strict Row-by-Row Alignment (Typography & Spacing Lock) */
.code-block .code-lines span.code-line-num,
.code-block.streaming .code-lines span.code-line-num {
    display: block !important;
    text-align: right !important;
    padding-right: 12px !important;
    padding-left: 6px !important;
    color: rgba(255, 255, 255, 0.3) !important;
}

/* The Magic Lock: Exact Typography Match */
.code-block .code-lines span.code-line-num,
.code-block.streaming .code-lines span.code-line-num,
.code-block .code-stream-pre,
.code-block.streaming .code-stream-pre,
.code-block .code-stream-pre code,
.code-block.streaming .code-stream-body,
.code-block .code-content,
.code-block .code-content pre,
.code-block .code-content pre code,
.code-block .code-content .code-line {
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 14px !important;
    line-height: 24px !important; /* Forces row alignment */
    min-height: 24px !important;
    box-sizing: border-box !important;
}

.code-block .code-lines span.code-line-num,
.code-block.streaming .code-lines span.code-line-num {
    height: 24px !important;
    max-height: 24px !important;
}

.code-block .code-line {
    display: block !important;
    padding: 0 !important;
    height: 24px !important;
    white-space: pre !important;
}

[data-theme="light"] .code-block .code-lines span.code-line-num,
[data-theme="light"] .code-block.streaming .code-lines span.code-line-num {
    color: rgba(0, 0, 0, 0.35) !important;
}

[data-theme="light"] .code-stream-pre,
[data-theme="light"] .code-block .code-content {
    color: rgba(0, 0, 0, 0.88) !important;
}

.code-stream-body {
    display: block !important;
    margin: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    color: inherit !important;
    white-space: inherit !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
}

.code-streaming-badge {
    font-size: 11px;
    font-weight: 500;
    color: #f59e0b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* --- 5. Lightbox Modal --- */
.study-lightbox-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: lightboxFadeIn 0.2s ease forwards;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.study-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.study-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.08);
}

.study-lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.study-lightbox-img {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.study-lightbox-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #f1f5f9;
    font-size: 13px;
    text-align: center;
}

.study-lightbox-source-link {
    color: #f59e0b;
    text-decoration: none;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    transition: background 0.15s;
}

.study-lightbox-source-link:hover {
    background: rgba(245, 158, 11, 0.22);
}

/* Hide Camera Option on Desktop */
@media (min-width: 1024px) {
    #camera-item {
        display: none !important;
    }
}

/* KaTeX Math Overflow Fixes */
.katex-display {
    display: block !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 8px 0 !important;
    margin: 0.8em 0 !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.katex-display::-webkit-scrollbar {
    height: 6px;
}

.katex-display::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.katex-display > .katex {
    display: inline-block;
    max-width: 100%;
    text-align: left;
}

.katex {
    font-size: 1.05em;
    max-width: 100%;
}

/* ========================================================================= */
/* NOX DOCUMENT ENGINE: INTERACTIVE ATTACHMENT CARD                          */
/* ========================================================================= */
.message-text.document-result {
    padding: 12px 14px !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
}

[data-theme="light"] .message-text.document-result {
    background: #ffffff !important;
    border-color: #e2e8f0;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.06);
}

.msg-document-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.doc-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.doc-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.doc-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow: hidden;
}

.doc-card-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.doc-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .doc-card-title {
    color: #0f172a;
}

.doc-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}

[data-theme="light"] .doc-card-meta {
    color: #64748b;
}

.doc-card-drive-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #38bdf8;
}

[data-theme="light"] .doc-card-drive-tag {
    color: #0284c7;
}

.doc-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.doc-btn-download,
.doc-btn-drive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.18s ease;
    cursor: pointer;
}

.doc-btn-download {
    background: #d97706;
    color: #ffffff !important;
    border: 1px solid transparent;
}

.doc-btn-download:hover {
    background: #b45309;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(217, 119, 6, 0.35);
}

.doc-btn-drive {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1 !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .doc-btn-drive {
    background: #f1f5f9;
    color: #334155 !important;
    border-color: #cbd5e1;
}

.doc-btn-drive:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff !important;
    transform: translateY(-1px);
}

[data-theme="light"] .doc-btn-drive:hover {
    background: #e2e8f0;
    color: #0f172a !important;
}

/* =========================================================
   GEMINI-STYLE THREE-DOTS MENU & DYNAMIC AUDIO BAR
   ========================================================= */

.msg-more-popup {
    position: fixed;
    background: rgba(22, 22, 30, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 5px;
    min-width: 130px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.95);
    transform-origin: bottom left;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.55), 0 0 1px 1px rgba(255, 255, 255, 0.06);
}

.msg-more-popup.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: popupSlideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popupSlideUp {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.94);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-more-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main, #e2e8f0);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.msg-more-item:hover {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.msg-more-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted, #94a3b8);
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.msg-more-item:hover i {
    color: #f59e0b;
}

[data-theme="light"] .msg-more-popup {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .msg-more-item {
    color: #1e293b;
}

[data-theme="light"] .msg-more-item:hover {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

[data-theme="light"] .msg-more-item:hover i {
    color: #d97706;
}

/* --- Dynamic Inline Audio Player Bar --- */
.msg-inline-audio-bar {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 8px 0 5px;
    margin-left: 6px;
    border-radius: 20px;
    background: rgba(245, 158, 11, 0.09);
    border: 1px solid rgba(245, 158, 11, 0.28);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 2px 10px -2px rgba(245, 158, 11, 0.15);
    animation: audioBarPopIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    vertical-align: middle;
}

.msg-inline-audio-bar.unmounting {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes audioBarPopIn {
    0% { opacity: 0; transform: scale(0.7) translateX(-6px); }
    100% { opacity: 1; transform: scale(1) translateX(0); }
}

.audio-bar-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.audio-bar-btn:hover {
    transform: scale(1.15);
    background: #f59e0b;
    color: #0f172a;
}

.audio-bar-btn:active {
    transform: scale(0.92);
}

.audio-bar-btn.stop-play {
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 11px;
}

.audio-bar-btn.stop-play:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.audio-bar-waveform {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 14px;
    padding: 0 2px;
}

.wave-bar {
    width: 2.5px;
    height: 4px;
    min-height: 3px;
    max-height: 14px;
    border-radius: 2px;
    background: #f59e0b;
    transform-origin: bottom;
    opacity: 0.5;
    transition: height 0.05s ease, opacity 0.05s ease;
    will-change: height, opacity;
}

.msg-inline-audio-bar.paused .wave-bar {
    height: 4px !important;
    opacity: 0.35 !important;
}

.audio-bar-spinner {
    font-size: 11px;
    color: #f59e0b;
}

.audio-bar-label {
    font-size: 11.5px;
    font-weight: 500;
    color: #f59e0b;
    letter-spacing: 0.2px;
}

[data-theme="light"] .msg-inline-audio-bar {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
}

/* ==========================================================================
   NOX PROACTIVE AGENT: REMINDER & ALARM CARDS (PHASE 2)
   ========================================================================== */

.proactive-spoken-text {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main, #f8fafc);
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.nox-proactive-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 520px;
    padding: 14px 16px;
    border-radius: 14px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    margin: 8px 0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    font-family: inherit;
}

/* 1. Scheduled & Rescheduled State (Amber / Yellow) */
.nox-proactive-card.proactive-scheduled,
.nox-proactive-card.proactive-rescheduled {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.28);
    box-shadow: 0 4px 20px -4px rgba(245, 158, 11, 0.12);
}

[data-theme="light"] .nox-proactive-card.proactive-scheduled,
[data-theme="light"] .nox-proactive-card.proactive-rescheduled {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.38);
    box-shadow: 0 4px 16px -4px rgba(245, 158, 11, 0.16);
}

.nox-proactive-card.proactive-scheduled .proactive-card-icon,
.nox-proactive-card.proactive-rescheduled .proactive-card-icon {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
}

.nox-proactive-card.proactive-scheduled .proactive-badge,
.nox-proactive-card.proactive-rescheduled .proactive-badge {
    color: #f59e0b;
}

/* 2. Ringing State (Pulsing Red-Orange Beacon) */
.nox-proactive-card.proactive-ringing {
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.45);
    animation: ringPulse 1.6s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

[data-theme="light"] .nox-proactive-card.proactive-ringing {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239, 68, 68, 0.55);
}

.nox-proactive-card.proactive-ringing .proactive-card-icon {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.nox-proactive-card.proactive-ringing .proactive-card-icon i {
    animation: bellShake 0.9s infinite ease-in-out;
}

.nox-proactive-card.proactive-ringing .proactive-badge {
    color: #ef4444;
}

/* 3. Completed State (Emerald Green) */
.nox-proactive-card.proactive-completed {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.32);
    box-shadow: 0 3px 12px -3px rgba(16, 185, 129, 0.12);
}

[data-theme="light"] .nox-proactive-card.proactive-completed {
    background: rgba(16, 185, 129, 0.11);
    border-color: rgba(16, 185, 129, 0.40);
    box-shadow: 0 2px 10px -2px rgba(16, 185, 129, 0.12);
}

.nox-proactive-card.proactive-completed .proactive-card-icon,
.nox-proactive-card.proactive-completed .proactive-compact-icon {
    background: rgba(16, 185, 129, 0.16);
    color: #10b981;
}

.nox-proactive-card.proactive-completed .proactive-badge,
.nox-proactive-card.proactive-completed .proactive-compact-badge {
    color: #10b981;
}

/* 4. Cancelled State (Muted Rose / Neutral) */
.nox-proactive-card.proactive-cancelled {
    background: rgba(244, 63, 94, 0.07);
    border: 1px solid rgba(244, 63, 94, 0.25);
    box-shadow: 0 3px 12px -3px rgba(244, 63, 94, 0.08);
    opacity: 0.88;
}

[data-theme="light"] .nox-proactive-card.proactive-cancelled {
    background: rgba(244, 63, 94, 0.09);
    border-color: rgba(244, 63, 94, 0.32);
}

.nox-proactive-card.proactive-cancelled .proactive-card-icon,
.nox-proactive-card.proactive-cancelled .proactive-compact-icon {
    background: rgba(244, 63, 94, 0.14);
    color: #f43f5e;
}

.nox-proactive-card.proactive-cancelled .proactive-badge,
.nox-proactive-card.proactive-cancelled .proactive-compact-badge {
    color: #f43f5e;
}

.nox-proactive-card.proactive-cancelled .proactive-title,
.nox-proactive-card.proactive-cancelled .proactive-compact-title {
    text-decoration: line-through;
    opacity: 0.72;
}

/* 5. Expired / Missed State (Muted Slate) */
.nox-proactive-card.proactive-expired {
    background: rgba(148, 163, 184, 0.07);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 3px 12px -3px rgba(148, 163, 184, 0.06);
    opacity: 0.82;
}

[data-theme="light"] .nox-proactive-card.proactive-expired {
    background: rgba(148, 163, 184, 0.10);
    border-color: rgba(148, 163, 184, 0.28);
}

.nox-proactive-card.proactive-expired .proactive-card-icon,
.nox-proactive-card.proactive-expired .proactive-compact-icon {
    background: rgba(148, 163, 184, 0.14);
    color: #94a3b8;
}

.nox-proactive-card.proactive-expired .proactive-badge,
.nox-proactive-card.proactive-expired .proactive-compact-badge {
    color: #94a3b8;
}

.nox-proactive-card.proactive-expired .proactive-title,
.nox-proactive-card.proactive-expired .proactive-compact-title {
    opacity: 0.72;
}

/* Compact Finished Pill Modifier */
.nox-proactive-card.proactive-compact,
.nox-proactive-card.proactive-completed,
.nox-proactive-card.proactive-cancelled,
.nox-proactive-card.proactive-expired {
    max-width: 300px;
    padding: 8px 12px;
    border-radius: 12px;
    gap: 0;
    margin: 6px 0;
    animation: proactiveCompactIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.nox-proactive-card.proactive-compact:hover {
    filter: brightness(1.04);
}

/* Hide all action buttons on finished cards */
.nox-proactive-card.proactive-compact .proactive-actions,
.nox-proactive-card.proactive-compact .proactive-card-actions,
.nox-proactive-card.proactive-completed .proactive-actions,
.nox-proactive-card.proactive-completed .proactive-card-actions,
.nox-proactive-card.proactive-cancelled .proactive-actions,
.nox-proactive-card.proactive-cancelled .proactive-card-actions,
.nox-proactive-card.proactive-expired .proactive-actions,
.nox-proactive-card.proactive-expired .proactive-card-actions {
    display: none !important;
}

/* Compact Inner Layout */
.proactive-compact-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.proactive-compact-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.proactive-compact-icon i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1 !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    font-size: 13px !important;
}

.proactive-compact-content {
    display: flex;
    flex-direction: column;
    gap: 1.5px;
    flex: 1;
    min-width: 0;
}

.proactive-compact-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

[data-theme="light"] .proactive-compact-title {
    color: #0f172a;
}

.proactive-compact-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    line-height: 1.2;
}

.proactive-compact-badge {
    display: inline-flex;
    align-items: center;
    gap: 4.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.proactive-compact-badge i {
    font-size: 10px !important;
    line-height: 1 !important;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
}

.proactive-compact-dot {
    opacity: 0.35;
    color: #94a3b8;
    font-size: 10px;
}

.proactive-compact-time {
    color: #94a3b8;
    font-weight: 400;
}

[data-theme="light"] .proactive-compact-time {
    color: #64748b;
}

/* Card Structure */
.proactive-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.proactive-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

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

.proactive-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.proactive-title {
    font-size: 14.5px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .proactive-title {
    color: #0f172a;
}

.proactive-time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}

[data-theme="light"] .proactive-time {
    color: #64748b;
}

.proactive-time-highlight {
    font-weight: 600;
    color: #e2e8f0;
}

[data-theme="light"] .proactive-time-highlight {
    color: #1e293b;
}

/* Actions */
.proactive-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.proactive-btn-complete {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: all 0.18s ease;
}

.proactive-btn-complete:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
    filter: brightness(1.06);
}

.proactive-btn-complete:active {
    transform: translateY(0);
}

.proactive-btn-cancel,
.proactive-btn-snooze {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

[data-theme="light"] .proactive-btn-cancel,
[data-theme="light"] .proactive-btn-snooze {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.12);
    color: #475569;
}

.proactive-btn-cancel:hover,
.proactive-btn-snooze:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

[data-theme="light"] .proactive-btn-cancel:hover,
[data-theme="light"] .proactive-btn-snooze:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #0f172a;
}

/* Animations */
@keyframes ringPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@keyframes bellShake {
    0%, 100% {
        transform: rotate(0deg);
    }
    15% {
        transform: rotate(14deg);
    }
    30% {
        transform: rotate(-14deg);
    }
    45% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(-10deg);
    }
    75% {
        transform: rotate(4deg);
    }
}

@keyframes proactiveCompactIn {
    0% {
        opacity: 0.5;
        transform: scale(0.98) translateY(1px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================================================
   NOX SPATIAL AWARENESS — PHASE 4: 3D CINEMATIC MAP CARD
   ========================================================================== */

.nox-spatial-map-card {
    position: relative;
    width: 100%;
    max-width: 580px;
    height: auto;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    margin: 10px 0 2px 0;
    border-radius: 20px;
    overflow: hidden;
    background: transparent !important;
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #1e293b;
    font-family: inherit;
    animation: spatialCardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

.message.ai .message-text:has(.nox-spatial-map-card) {
    padding-bottom: 16px !important;
}

@keyframes spatialCardFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nox-map-header {
    position: absolute !important;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.80) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.60);
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.12);
}

.nox-map-title-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.nox-map-badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.12) 0%, rgba(52, 168, 83, 0.10) 100%);
    border: 1px solid rgba(66, 133, 244, 0.25);
    color: #4285f4;
    font-size: 14px;
    box-shadow: 0 1px 4px rgba(66, 133, 244, 0.15);
    flex-shrink: 0;
}

.nox-map-title-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nox-map-title-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.nox-map-subtitle-text {
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nox-map-controls-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.nox-map-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.10);
    color: #475569;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nox-map-btn:hover {
    background: rgba(66, 133, 244, 0.12);
    border-color: rgba(66, 133, 244, 0.3);
    color: #4285f4;
    transform: scale(1.05);
}

.nox-map-btn.active {
    background: rgba(66, 133, 244, 0.15);
    border-color: #4285f4;
    color: #4285f4;
    box-shadow: 0 0 8px rgba(66, 133, 244, 0.2);
}

.nox-map-canvas-container {
    position: relative !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 230px !important;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    background: #eef2f6;
    z-index: 1;
}

/* Standalone 3D Route Map (when no places carousel is present) */
.nox-spatial-map-card:not(:has(.nox-places-carousel)) .nox-map-canvas-container {
    height: 320px !important;
    border-radius: 20px;
}

.nox-map-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.nox-map-canvas-container.map-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999;
    border-radius: 0;
}

/* Cinematic Bottom HUD Overlay */
.nox-map-hud-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 120px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    pointer-events: none;
    z-index: 10;
}

.nox-map-chips-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    pointer-events: auto;
}

.nox-map-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.50);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    color: #1e293b;
}

.nox-map-chip.accent {
    border-color: rgba(66, 133, 244, 0.4);
    color: #1d4ed8;
}

.nox-map-chip.amber {
    border-color: rgba(234, 67, 53, 0.4);
    color: #dc2626;
}

.nox-map-hud-tag {
    display: none !important;
}

/* Google-Style Map Markers */
.nox-marker-origin {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4285f4;
    border: 2.5px solid #ffffff;
    box-shadow: 0 1px 6px rgba(66, 133, 244, 0.6);
    cursor: pointer;
}

.nox-marker-origin::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(66, 133, 244, 0.4);
    animation: markerPulseCyan 2s infinite ease-out;
}

@keyframes markerPulseCyan {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(2.0); opacity: 0; }
}

.nox-marker-dest {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ea4335;
    border: 2.5px solid #ffffff;
    box-shadow: 0 1px 6px rgba(234, 67, 53, 0.6);
    cursor: pointer;
}

.nox-marker-dest::after {
    content: '';
    position: absolute;
    top: -7px;
    left: -7px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(234, 67, 53, 0.4);
    animation: markerPulseAmber 2s infinite ease-out;
}

@keyframes markerPulseAmber {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(2.0); opacity: 0; }
}

/* Google Attribution Overlay Badge */
.nox-map-google-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3.5px 8.5px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.50);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    font-size: 10px;
    font-weight: 500;
    color: #475569;
    pointer-events: none;
}

.nox-map-google-badge svg {
    width: 12px;
    height: 12px;
}

/* Dark Mode Overrides */
:root[data-theme="dark"] .nox-spatial-map-card {
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 12px 36px -6px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .nox-map-header {
    background: rgba(15, 23, 42, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

:root[data-theme="dark"] .nox-map-title-text {
    color: #f8fafc;
}

:root[data-theme="dark"] .nox-map-subtitle-text {
    color: #94a3b8;
}

:root[data-theme="dark"] .nox-map-btn {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

:root[data-theme="dark"] .nox-map-btn:hover {
    background: rgba(66, 133, 244, 0.25);
    border-color: rgba(66, 133, 244, 0.5);
    color: #93c5fd;
}

:root[data-theme="dark"] .nox-map-chip {
    background: rgba(15, 23, 42, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
}

:root[data-theme="dark"] .nox-map-chip.accent {
    border-color: rgba(96, 165, 250, 0.4);
    color: #60a5fa;
}

:root[data-theme="dark"] .nox-map-chip.amber {
    border-color: rgba(248, 113, 113, 0.4);
    color: #f87171;
}

:root[data-theme="dark"] .nox-map-google-badge {
    background: rgba(15, 23, 42, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
}

/* ==========================================================================
   NOX RICH PLACES & INTERACTIVE MAP CAROUSEL (CHATGPT MAPS BENCHMARK)
   ========================================================================== */

/* Places Carousel Container */
.nox-places-carousel {
    position: relative;
    width: 100%;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 12px 14px;
    background: rgba(10, 12, 16, 0.65);
    box-sizing: border-box;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.3) transparent;
}

.nox-places-carousel::-webkit-scrollbar {
    height: 4px;
}

.nox-places-carousel::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 4px;
}

.nox-places-carousel::-webkit-scrollbar-track {
    background: transparent;
}

/* Individual Place Card (Dark Glassmorphic) */
.nox-place-card {
    flex: 0 0 250px;
    width: 250px;
    scroll-snap-align: start;
    background: rgba(18, 20, 26, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
    position: relative;
    display: flex;
    flex-direction: column;
}

.nox-place-card:hover {
    transform: translateY(-3px);
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 12px 28px -4px rgba(245, 158, 11, 0.25), 0 0 0 1px rgba(245, 158, 11, 0.35);
}

.nox-place-card.active-place-card {
    border-color: #f59e0b !important;
    box-shadow: 0 12px 32px -4px rgba(245, 158, 11, 0.4), 0 0 0 2px rgba(245, 158, 11, 0.7) !important;
}

/* Photo Header */
.nox-place-img-wrapper {
    position: relative;
    width: 100%;
    height: 125px;
    overflow: hidden;
    background: #0f172a;
}

.nox-place-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.nox-place-card:hover .nox-place-img {
    transform: scale(1.06);
}

.nox-place-img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(18,20,26,0.85) 100%);
    pointer-events: none;
}

/* Numbered Pin Tag over Photo */
.nox-place-pin-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(245, 158, 11, 0.7);
    color: #f59e0b;
    font-size: 11px;
    font-weight: 800;
    padding: 2.5px 8px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Open / Closed Status Pill */
.nox-place-status-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2.5px 8px;
    border-radius: 12px;
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    gap: 4.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.nox-place-status-pill.open {
    background: rgba(16, 185, 129, 0.22);
    border: 1px solid rgba(16, 185, 129, 0.55);
    color: #34d399;
}

.nox-place-status-pill.closed {
    background: rgba(239, 68, 68, 0.22);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #f87171;
}

.nox-place-status-pill .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.nox-place-status-pill.open .status-dot {
    background: #34d399;
    box-shadow: 0 0 6px #34d399;
}

.nox-place-status-pill.closed .status-dot {
    background: #f87171;
}

/* Card Body */
.nox-place-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nox-place-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.nox-place-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.nox-place-category-badge {
    font-size: 9.5px;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Rating Row */
.nox-place-rating-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
}

.nox-place-rating-stars {
    display: flex;
    gap: 2px;
    font-size: 10.5px;
}

.nox-place-rating-score {
    font-weight: 700;
    color: #fbbf24;
}

.nox-place-reviews {
    color: #64748b;
    font-size: 11px;
}

/* Address Row */
.nox-place-address {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.35;
    max-height: 30px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.nox-place-address i {
    color: #ea4335;
    font-size: 10px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Action Chips Bar */
.nox-place-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.nox-place-actions::-webkit-scrollbar {
    display: none;
}

.nox-place-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Primary Directions Button with Text */
.nox-place-chip.directions {
    background: rgba(66, 133, 244, 0.20);
    color: #60a5fa;
    border: 1px solid rgba(66, 133, 244, 0.40);
    border-radius: 18px;
    padding: 6px 12px;
}

.nox-place-chip.directions:hover {
    background: rgba(66, 133, 244, 0.38);
    color: #ffffff;
}

/* Sleek Circular Icon-Only Action Buttons for Call, Website, Maps */
.nox-place-chip.call,
.nox-place-chip.website,
.nox-place-chip.maps,
.nox-place-chip.icon-only {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    border-radius: 50% !important;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nox-place-chip.call {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.nox-place-chip.call:hover {
    background: rgba(16, 185, 129, 0.35);
    color: #ffffff;
}

.nox-place-chip.website {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.nox-place-chip.website:hover {
    background: rgba(168, 85, 247, 0.35);
    color: #ffffff;
}

.nox-place-chip.maps {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.nox-place-chip.maps:hover {
    background: rgba(245, 158, 11, 0.35);
    color: #ffffff;
}

/* Numbered Map POI Marker */
.nox-poi-marker {
    position: relative;
    width: 32px;
    height: 38px;
    cursor: pointer;
    transform: translate(-50%, -100%);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nox-poi-marker:hover,
.nox-poi-marker.hovered-pin {
    transform: translate(-50%, -115%) scale(1.18);
    z-index: 100;
}

.poi-pin-inner {
    width: 28px;
    height: 28px;
    background: #ea4335;
    border: 2px solid #ffffff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(234, 67, 53, 0.55);
    margin: 0 auto;
    transition: background-color 0.2s ease;
}

.nox-poi-marker:hover .poi-pin-inner,
.nox-poi-marker.hovered-pin .poi-pin-inner {
    background: #f59e0b;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.7);
}

.poi-pin-num {
    transform: rotate(45deg);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.poi-pin-pulse {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 5px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    filter: blur(1px);
}

/* Map Popup Styling */
.nox-map-popup {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nox-map-popup .nox-popup-title {
    font-size: 12px;
    font-weight: 700;
    color: #f8fafc;
}

.nox-map-popup .nox-popup-rating {
    font-size: 11px;
    font-weight: 600;
    color: #fbbf24;
}

.nox-map-popup .nox-popup-addr {
    font-size: 10px;
    color: #94a3b8;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   NOX CHATGPT-TIER IMAGE GENERATION UI & INPAINTING DOCK
   ========================================================================== */

/* 1. Animated Generation Matrix Container */
.nox-image-generating-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.14) 0%, rgba(15, 23, 42, 0.95) 75%), #090d16;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), inset 0 0 24px rgba(168, 85, 247, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nox-gen-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.15), transparent 70%);
    filter: blur(20px);
    pointer-events: none;
}

.nox-gen-top-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.nox-gen-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 10px #f59e0b;
    animation: noxDotPulse 1.6s ease-in-out infinite;
}

@keyframes noxDotPulse {
    0%, 100% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px #f59e0b; }
}

.nox-gen-radar-center {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.nox-gen-pulse-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15);
    animation: noxRadarPulse 3s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
    pointer-events: none;
}

.nox-gen-pulse-ring.ring-1 { width: 60px; height: 60px; animation-delay: 0s; }
.nox-gen-pulse-ring.ring-2 { width: 100px; height: 100px; animation-delay: 1s; }
.nox-gen-pulse-ring.ring-3 { width: 140px; height: 140px; animation-delay: 2s; }

@keyframes noxRadarPulse {
    0% { transform: scale(0.5); opacity: 0.8; }
    80% { opacity: 0.2; }
    100% { transform: scale(1.6); opacity: 0; }
}

.nox-gen-core-spinner {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nox-gen-svg {
    width: 100%;
    height: 100%;
    animation: noxSpin 2.2s linear infinite;
}

@keyframes noxSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.nox-gen-sparkle-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.6));
    animation: noxSparkleFloat 2s ease-in-out infinite alternate;
}

@keyframes noxSparkleFloat {
    0% { transform: scale(0.92) rotate(-5deg); }
    100% { transform: scale(1.08) rotate(5deg); }
}

.nox-gen-progress-pill {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 5px 12px;
    border-radius: 20px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
    color: #f59e0b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 12px rgba(245, 158, 11, 0.2);
    z-index: 2;
}

/* Crossfade transitions */
.nox-gen-fading {
    opacity: 0 !important;
    transform: scale(0.97) !important;
    pointer-events: none !important;
}

.nox-image-entering {
    animation: noxImgEnter 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes noxImgEnter {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   NOX CONTINUOUS IMAGE PRESENTATION SURFACE & MORPH ENGINE
   ============================================================ */

/* 1. Reset outer message bubble: seamless transparent anchor */
.message.ai .message-text.media-image-message,
.message.ai .message-text:has(.nox-image-surface),
.message.ai .message-text:has(.nox-image-wrapper),
.message.ai:has(.nox-image-surface) .message-text,
.message.ai:has(.media-image-message) .message-text,
.message-text.media-image-message {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: fit-content !important;
    border-radius: 0 !important;
    white-space: normal !important;
    line-height: normal !important;
    font-size: 14px !important;
}

.message.ai.thinking-mode .message-text.media-image-message,
.message.ai.thinking-mode .message-text:has(.nox-image-surface),
.message.ai.thinking-mode .message-text:has(.nox-image-wrapper),
.message.ai.thinking-mode:has(.nox-image-surface) .message-text {
    display: flex !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    white-space: normal !important;
    line-height: normal !important;
}

.message-visual-slot:empty {
    display: none !important;
}

.message-text-slot:empty {
    display: none !important;
}

/* 2. Single Continuous Generation Surface */
.nox-image-surface {
    position: relative;
    width: 100%;
    max-width: 460px;
    background: #050505;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.55);
    margin-top: 0.35rem;
    box-sizing: border-box;
    white-space: normal !important;
    line-height: 0 !important;
    font-size: 0 !important;
    padding: 0 !important;
    display: block !important;
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
}

/* 3. Generation UI Layer (Inside the exact same surface) */
.nox-gen-layer {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #050505;
    line-height: normal !important;
    font-size: 14px !important;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Central Cinematic Animation Viewport (Clean Canvas Container) */
.nox-gen-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #050505;
    border-radius: 14px;
    line-height: 0 !important;
    font-size: 0 !important;
}

.nox-gen-viewport canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 14px;
}

/* Sleek bottom progress bar (connected directly to backend progress) */
.nox-gen-bottom-track {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 25;
    overflow: hidden;
}

.nox-gen-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ea580c, #f97316, #fb923c);
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.8), 0 0 4px #fb923c;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 4. Final Image Layer (Inside the exact same surface) */
.nox-img-layer {
    position: relative;
    width: 100%;
    max-width: 100%;
    display: block;
    overflow: hidden;
    border-radius: 14px;
    background: #050505;
    aspect-ratio: 16 / 9;
    line-height: 0 !important;
    font-size: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nox-img-layer img,
.nox-image-surface img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
    border-radius: 14px;
    cursor: zoom-in;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    line-height: 0 !important;
    font-size: 0 !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Responsive aspect ratio support: 16:9, 1:1, 9:16, 4:3 */
.nox-image-surface[data-ar="16:9"] {
    max-width: 460px;
}
.nox-image-surface[data-ar="16:9"] .nox-gen-viewport,
.nox-image-surface[data-ar="16:9"] .nox-img-layer,
.nox-image-surface[data-ar="16:9"] img {
    aspect-ratio: 16 / 9;
}

.nox-image-surface[data-ar="1:1"] {
    max-width: 360px;
}
.nox-image-surface[data-ar="1:1"] .nox-gen-viewport,
.nox-image-surface[data-ar="1:1"] .nox-img-layer,
.nox-image-surface[data-ar="1:1"] img {
    aspect-ratio: 1 / 1;
}

.nox-image-surface[data-ar="9:16"] {
    max-width: 300px;
}
.nox-image-surface[data-ar="9:16"] .nox-gen-viewport,
.nox-image-surface[data-ar="9:16"] .nox-img-layer,
.nox-image-surface[data-ar="9:16"] img {
    aspect-ratio: 9 / 16;
}

.nox-image-surface[data-ar="4:3"] {
    max-width: 420px;
}
.nox-image-surface[data-ar="4:3"] .nox-gen-viewport,
.nox-image-surface[data-ar="4:3"] .nox-img-layer,
.nox-image-surface[data-ar="4:3"] img {
    aspect-ratio: 4 / 3;
}

.nox-image-surface:hover img {
    transform: scale(1.012);
}

/* 5. In-Image Action Controls Overlay */
.nox-image-action-overlay {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 15;
}

.image-action-btn {
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #f8fafc !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.image-action-btn:hover {
    background: rgba(30, 41, 59, 0.92) !important;
    border-color: rgba(245, 158, 11, 0.7) !important;
    color: #f59e0b !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.25) !important;
}

/* Soft light sweep effect upon 100% completion */
.nox-surface-sweep {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: 30;
    animation: surfaceSweep 0.5s ease-out forwards;
}

@keyframes surfaceSweep {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Backward compatibility wrapper alias */
.nox-image-wrapper {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
}

/* 3. Pinned Inpainting & Edit Input Dock */
.image-edit-dock {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35), 0 0 14px rgba(245, 158, 11, 0.12);
    animation: noxSlideDown 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.image-edit-thumb-container {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.image-edit-thumb-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: block;
}

.image-edit-thumb-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s, background 0.15s;
}

.image-edit-thumb-close:hover {
    background: #dc2626;
    transform: scale(1.15);
}

.image-edit-meta-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.image-edit-meta-title {
    font-size: 12px;
    font-weight: 700;
    color: #f59e0b;
    display: flex;
    align-items: center;
    gap: 5px;
}

.image-edit-meta-sub {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================
   PREMIUM CANVAS IMAGE GENERATION STYLING
   ======================================================== */
.nox-premium-img-container {
    position: relative;
    width: 100%;
    max-width: 460px;
    aspect-ratio: 1 / 1;
    background: #0a0a0c;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.nox-particle-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    transition: opacity 0.6s ease-out;
}
.nox-gen-status {
    position: absolute;
    bottom: 20px;
    z-index: 2;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.5px;
    animation: pulseText 2s infinite ease-in-out;
}
.nox-final-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 3;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.nox-final-image.revealed {
    opacity: 1;
    transform: scale(1);
}
@keyframes pulseText {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}
/* Video Message Bubble Reset & Unified Sizing */
.message.ai .message-text:has(.nox-video-wrapper),
.message.ai:has(.nox-video-wrapper) .message-text {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}
.nox-video-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 460px !important;
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    background: #050505;
}

/* --- Premium Feature Gating & Quota Styles --- */
.popup-item.mode-exhausted {
    opacity: 0.42;
    filter: grayscale(0.55);
    cursor: not-allowed !important;
    position: relative;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.popup-item.mode-exhausted:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-muted) !important;
}

.popup-item.mode-exhausted .mode-s-icon {
    opacity: 0.6;
}

.popup-item.mode-locked {
    position: relative;
}

.popup-item.mode-locked .mode-s-icon {
    position: relative;
}

.popup-item.mode-locked .mode-s-icon::after {
    content: "\f023";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    bottom: -3px;
    right: -3px;
    font-size: 8px;
    background: #18191a;
    color: #f59e0b;
    border-radius: 50%;
    padding: 1.5px 2px;
    line-height: 1;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.mode-quota-pill {
    display: none !important;
}

/* ========================================================
   PROJECT LETHAL SHOPPING: ULTRA-PREMIUM CARD GRID UI
   ======================================================== */
.nox-shopping-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,248px)); justify-content:start; gap:12px; margin:14px 0; width:min(100%,780px); }
.nox-premium-card { width:100%; min-width:0; background:linear-gradient(155deg,#fff 0%,#f8fafc 100%); border:1px solid rgba(15,23,42,.10); border-radius:16px; padding:10px; display:flex; flex-direction:column; color:#0f172a!important; transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease; box-shadow:0 8px 24px rgba(15,23,42,.10); overflow:hidden; }
.nox-premium-card:hover { transform:translateY(-2px); border-color:rgba(16,185,129,.32); box-shadow:0 12px 30px rgba(15,23,42,.15); }
.nox-card-img-box { width:100%; height:132px; display:flex; align-items:center; justify-content:center; background:linear-gradient(145deg,#fff,#f1f5f9); border:1px solid rgba(15,23,42,.06); border-radius:12px; margin-bottom:9px; overflow:hidden; padding:8px; position:relative; }
.nox-card-img-box img { max-width: 100%; max-height: 100%; object-fit: contain; filter: contrast(1.05); }
.nox-image-fallback { display:none; color:#94a3b8; font-size:12px; gap:7px; align-items:center; }
.nox-card-img-box.image-unavailable .nox-image-fallback,.nox-card-img-box:not(:has(img)) .nox-image-fallback { display:flex; }
.nox-card-meta { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.nox-card-meta span { padding:4px 8px; border-radius:999px; background:#ecfdf5; color:#047857; font-size:10px; font-weight:750; letter-spacing:.02em; }
.message .nox-card-title { display:-webkit-box; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:2; font-size:14px; color:#0f172a!important; font-weight:750; margin:0 0 6px; line-height:1.35; }
.message .nox-card-details { display:-webkit-box; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:3; font-size:11.5px; color:#64748b!important; margin:0 0 9px; line-height:1.45; }
.nox-card-advice { font-size:11px; line-height:1.45; color:#92400e; background:#fffbeb; border:1px solid #fde68a; padding:8px 9px; border-radius:10px; margin:0 0 11px; }
.nox-card-price-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; margin-top: auto; }
.message .nox-card-price { font-size:18px; font-weight:850; color:#0f172a!important; }
.nox-card-verdict { font-size: 14px; }
.verdict-green { color: #10b981; } /* Emerald Green */
.verdict-orange { color: #f59e0b; } /* Amber Orange */
.nox-card-btn { display: flex; justify-content: center; align-items: center; padding: 10px; border-radius: 10px; font-weight: 600; font-size: 14px; text-decoration: none; transition: filter 0.2s, transform 0.15s; }
.btn-buy-now { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: white; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.btn-check-price { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: white; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.btn-unavailable { background:#e2e8f0; color:#64748b; cursor:not-allowed; box-shadow:none; }
.nox-card-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
@media (max-width:760px){.nox-shopping-grid{grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:10px}.nox-card-img-box{height:125px}}
@media (max-width:520px){.nox-shopping-grid{grid-template-columns:1fr;width:100%;margin:12px 0}.nox-premium-card{max-width:100%;padding:9px;border-radius:14px}.nox-card-img-box{height:128px}.nox-card-details{-webkit-line-clamp:2}.nox-card-btn{padding:9px}}
