@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;
}

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;
    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 .new-chat-btn {
    width: 40px;
    padding: 0;
    gap: 0;
    margin-left: -3px;
    justify-content: center;
    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);
}

.menu-btn:hover .sidebar-logo {
    opacity: 0;
}

.menu-btn:hover .sidebar-bars-icon {
    opacity: 1;
}

.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%;
    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;
}

.message.ai {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.message-text {
    max-width: 90% !important;
    padding: 14px 22px 30px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    word-wrap: break-word;
    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: inline;
}

.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);
}

@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;
}

@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: 8px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.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: 1px solid rgba(255, 255, 255, 0.02);
    background: rgba(255, 255, 255, 0.01);
}

.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-inline-img {
    width: 100%;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}

/* --- 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);
}

.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);
}

.sound-btn {
    position: relative;
}

.sound-btn.off::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 22%;
    width: 56%;
    height: 2px;
    background: var(--text-muted);
    transform: translateY(-50%) rotate(-45deg);
    border-radius: 1px;
    pointer-events: none;
}

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

.sound-btn.recording:not(.off) {
    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);
    }
}

/* --- 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-popup {
    background: rgba(30, 31, 32, 0.6);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    max-height: 70vh;
    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), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
}

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

[data-theme="light"] .tools-popup {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(40px) saturate(1.4);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

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

.tools-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.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: 1fr 1fr;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tools-list::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

.tools-list::-webkit-scrollbar-track {
    display: none;
}

.tools-list::-webkit-scrollbar-thumb {
    display: none;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    animation: cardSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.tool-card:nth-child(1) {
    animation-delay: 0.02s;
}

.tool-card:nth-child(2) {
    animation-delay: 0.04s;
}

.tool-card:nth-child(3) {
    animation-delay: 0.06s;
}

.tool-card:nth-child(4) {
    animation-delay: 0.08s;
}

.tool-card:nth-child(5) {
    animation-delay: 0.10s;
}

.tool-card:nth-child(6) {
    animation-delay: 0.12s;
}

.tool-card:nth-child(7) {
    animation-delay: 0.14s;
}

.tool-card:nth-child(8) {
    animation-delay: 0.16s;
}

.tool-card:nth-child(9) {
    animation-delay: 0.18s;
}

.tool-card:nth-child(10) {
    animation-delay: 0.20s;
}

.tool-card:nth-child(11) {
    animation-delay: 0.22s;
}

.tool-card:nth-child(12) {
    animation-delay: 0.24s;
}

@keyframes cardSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

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

.tool-card:hover {
    background: var(--hover-color);
    color: var(--text-main);
    transform: translateX(4px);
}

.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;
    white-space: nowrap;
}

/* ========================================= */
/* 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: 480px;
    }

    .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 {
        max-width: 312px;
        padding: 14px;
    }

    .tools-title {
        font-size: 19px;
    }

    .tools-list {
        gap: 8px;
    }

    .tool-icon {
        width: 28px;
        height: 28px;
    }

    .tool-icon i {
        font-size: 14px;
    }

    .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 {
        max-width: 264px;
        width: 92%;
        padding: 12px;
    }

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

    .tool-card {
        padding: 7px 9px;
        gap: 6px;
    }

    .tool-card span {
        font-size: 11px;
    }

    .tool-icon {
        width: 24px;
        height: 24px;
    }

    .tool-icon i {
        font-size: 11px;
    }

    .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 {
        max-width: 216px;
        width: 94%;
        padding: 12px;
        border-radius: 16px;
    }

    .tools-title {
        font-size: 13px;
    }

    .tools-list {
        gap: 4px;
    }

    .tool-card {
        padding: 5px 7px;
        gap: 5px;
    }

    .tool-card span {
        font-size: 10px;
    }

    .tool-icon {
        width: 20px;
        height: 20px;
    }

    .tool-icon i {
        font-size: 10px;
    }

    .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 {
        position: relative !important;
        width: 92% !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 auto !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;
        max-height: 100dvh !important;
    }

    /* 2. Lift chat box & reveal disclaimer via safe-area bottom padding & prevent squashing */
    .main-content {
        width: 100% !important;
        flex: none !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: 10px !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;
}

.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: 140px !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;
    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;
}