/* ==========================================================================
   SIKKHALAY TEACHER PORTAL — AI TEACHING ASSISTANT STYLESHEET
   Google Gemini 2.5 Flash & ChatGPT Advanced Pedagogical Workspace
   Theme: Professional Emerald (#059669), Dark Slate (#0F172A) & Pure Canvas
   ========================================================================== */

:root {
    --gemini-canvas-bg: #F8FAFC;
    --gemini-canvas-text: #0F172A;
    --gemini-surface: #FFFFFF;
    --gemini-border: #E2E8F0;
    --gemini-muted-text: #64748B;
    --gemini-header-bg: rgba(248, 250, 252, 0.88);
    --gemini-sidebar-bg: #070B14;
    --gemini-sidebar-text: #F8FAFC;
    --gemini-sidebar-border: rgba(255, 255, 255, 0.08);
    --gemini-sidebar-surface: #0F172A;
    --gemini-user-bubble-bg: #ECFDF5;
    --gemini-user-bubble-border: rgba(5, 150, 105, 0.25);
    --gemini-ai-bubble-bg: #FFFFFF;
    --gemini-hero-card-bg: #FFFFFF;
    --gemini-hero-card-hover: #F0FDF4;
    --gemini-input-dock-gradient: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(248, 250, 252, 0.95) 25%, #F8FAFC 100%);
    --gemini-input-card-bg: #FFFFFF;
    --gemini-primary: #059669;
    --gemini-primary-hover: #047857;
    --gemini-primary-light: #ECFDF5;
    --gemini-primary-glow: rgba(5, 150, 105, 0.25);
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"],
body.dark-theme {
    --gemini-canvas-bg: #0B0F19;
    --gemini-canvas-text: #F8FAFC;
    --gemini-surface: #151C2C;
    --gemini-border: #1E293B;
    --gemini-muted-text: #94A3B8;
    --gemini-header-bg: rgba(11, 15, 25, 0.88);
    --gemini-sidebar-bg: #070B14;
    --gemini-sidebar-text: #F8FAFC;
    --gemini-sidebar-border: rgba(255, 255, 255, 0.08);
    --gemini-sidebar-surface: #0F172A;
    --gemini-user-bubble-bg: #064E3B;
    --gemini-user-bubble-border: rgba(16, 185, 129, 0.35);
    --gemini-ai-bubble-bg: #151C2C;
    --gemini-hero-card-bg: #151C2C;
    --gemini-hero-card-hover: #1A2338;
    --gemini-input-dock-gradient: linear-gradient(180deg, rgba(11, 15, 25, 0) 0%, rgba(11, 15, 25, 0.95) 25%, #0B0F19 100%);
    --gemini-input-card-bg: #151C2C;
    --gemini-primary: #10B981;
    --gemini-primary-hover: #059669;
    --gemini-primary-light: rgba(16, 185, 129, 0.15);
    --gemini-primary-glow: rgba(16, 185, 129, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--gemini-canvas-bg);
    color: var(--gemini-canvas-text);
}

/* ==========================================================================
   1. ADVANCED APP SHELL LAYOUT
   ========================================================================== */
.gemini-app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--gemini-canvas-bg);
    color: var(--gemini-canvas-text);
    transition: background 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   2. LEFT CONVERSATION HISTORY SIDEBAR
   ========================================================================== */
.gemini-history-sidebar {
    width: 295px;
    min-width: 295px;
    height: 100vh;
    height: 100dvh;
    background: var(--gemini-sidebar-bg);
    color: var(--gemini-sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--gemini-sidebar-border);
    z-index: 100;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gemini-history-sidebar.collapsed {
    margin-left: -295px;
}

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

.gemini-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.gemini-spark-badge {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    font-size: 15px;
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.45);
}

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

.gemini-brand-title {
    font-size: 15px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.2px;
}

.gemini-brand-subtitle {
    font-size: 10.5px;
    font-weight: 600;
    color: #34D399;
}

.gemini-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    color: #94A3B8;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.gemini-back-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
}

/* + New Chat Action */
.gemini-new-chat-wrapper {
    padding: 12px 16px 8px 16px;
}

.gemini-new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.2) 0%, rgba(4, 120, 87, 0.35) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gemini-new-chat-btn:hover {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.35) 0%, rgba(4, 120, 87, 0.55) 100%);
    border-color: #34D399;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

/* Sidebar Search */
.gemini-sidebar-search-box {
    padding: 4px 16px 8px 16px;
}

.gemini-sidebar-search-wrapper {
    position: relative;
    width: 100%;
}

.gemini-sidebar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #64748B;
    pointer-events: none;
}

.gemini-sidebar-search-input {
    width: 100%;
    padding: 7px 10px 7px 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #F8FAFC;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.gemini-sidebar-search-input::placeholder {
    color: #64748B;
}

.gemini-sidebar-search-input:focus {
    background: rgba(255, 255, 255, 0.09);
    border-color: #34D399;
}

/* Category Tabs */
.gemini-sidebar-tabs {
    display: flex;
    padding: 4px 16px 8px 16px;
    gap: 6px;
}

.gemini-side-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #94A3B8;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gemini-side-tab-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.05);
}

.gemini-side-tab-btn.active {
    background: #1E293B;
    color: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.gemini-side-tab-badge {
    font-size: 9px;
    padding: 1px 5px;
    background: #059669;
    color: #FFFFFF;
    border-radius: 9999px;
}

/* History List */
.gemini-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.gemini-history-list::-webkit-scrollbar {
    width: 4px;
}

.gemini-history-list::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

.gemini-history-group-title {
    font-size: 10px;
    font-weight: 800;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 8px 4px 8px;
}

.gemini-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    color: #94A3B8;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.gemini-history-item:hover {
    background: #1E293B;
    color: #F8FAFC;
}

.gemini-history-item.active {
    background: #1E293B;
    color: #FFFFFF;
    font-weight: 700;
    border-left: 3px solid #10B981;
}

.gemini-history-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

.gemini-history-item-icon {
    font-size: 12px;
    color: #64748B;
    flex-shrink: 0;
}

.gemini-history-item.active .gemini-history-item-icon {
    color: #10B981;
}

.gemini-history-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gemini-history-meta {
    font-size: 10px;
    color: #64748B;
    flex-shrink: 0;
    margin-left: 6px;
}

.gemini-history-item-actions {
    display: none;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    margin-left: 6px;
}

.gemini-history-item:hover .gemini-history-meta {
    display: none;
}

.gemini-history-item:hover .gemini-history-item-actions {
    display: flex;
}

.gemini-history-action-icon {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 11px;
    padding: 3px 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.gemini-history-action-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #EF4444;
}

/* Sidebar Footer & Teacher Profile */
.gemini-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gemini-sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #070B14;
}

.gemini-profile-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    overflow: hidden;
    flex: 1;
}

.gemini-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid #059669;
    object-fit: cover;
    flex-shrink: 0;
}

.gemini-profile-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gemini-profile-name {
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gemini-profile-class {
    font-size: 10.5px;
    color: #34D399;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Settings Button */
.gemini-sidebar-settings-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.gemini-sidebar-settings-btn:hover {
    background: rgba(5, 150, 105, 0.18);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34D399;
    transform: rotate(30deg);
}

/* Settings Popup — Slides up inside sidebar above footer */
.gemini-settings-popup {
    position: absolute;
    bottom: 64px;
    left: 10px;
    right: 10px;
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    z-index: 120;
    transform: translateY(12px) scale(0.97);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease, visibility 0.22s;
}

.gemini-settings-popup.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.gemini-settings-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #F1F5F9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gemini-settings-close-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: #94A3B8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s ease;
}

.gemini-settings-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.gemini-settings-popup-body {
    padding: 8px 0 12px 0;
}

.gemini-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 10px;
    transition: background 0.15s ease;
}

.gemini-settings-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.gemini-settings-row-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #CBD5E1;
}

.gemini-settings-row-label i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}

/* Toggle Switch */
.gemini-settings-toggle {
    width: 44px;
    height: 24px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
    padding: 0;
}

.gemini-settings-toggle.active {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #34D399;
}

.gemini-settings-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
}

.gemini-settings-toggle.active .gemini-settings-toggle-knob {
    transform: translateX(20px);
}

/* Action buttons in settings */
.gemini-settings-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #94A3B8;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.gemini-settings-action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #F1F5F9;
}

/* ==========================================================================
   3. CENTRAL CHAT CANVAS
   ========================================================================== */
.gemini-chat-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: relative;
    background: var(--gemini-canvas-bg);
    color: var(--gemini-canvas-text);
    overflow: hidden;
    transition: background 0.25s ease, color 0.25s ease;
}

/* Header */
.gemini-canvas-header {
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--gemini-border);
    background: var(--gemini-header-bg);
    backdrop-filter: blur(10px);
    z-index: 10;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.gemini-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gemini-header-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 9999px;
    background: var(--gemini-surface);
    border: 1px solid var(--gemini-border);
    color: var(--gemini-muted-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.gemini-header-back-btn:hover {
    background: var(--gemini-border);
    color: var(--gemini-canvas-text);
}

.gemini-model-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 9999px;
    background: var(--gemini-surface);
    border: 1px solid var(--gemini-border);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--gemini-canvas-text);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.gemini-model-pill:hover {
    border-color: #10B981;
}

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

.gemini-header-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--gemini-border);
    background: var(--gemini-surface);
    color: var(--gemini-canvas-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.gemini-header-icon-btn:hover {
    background: var(--gemini-border);
    border-color: #10B981;
    color: #10B981;
}

/* AI Mode Dropdown Panel */
.ai-features-dropdown-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    background: var(--gemini-surface);
    border: 1px solid var(--gemini-border);
    border-radius: 16px;
    box-shadow: 0 12px 30px -6px rgba(15, 23, 42, 0.15), 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    padding: 8px;
    z-index: 120;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-features-dropdown-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

body.dark-theme .ai-features-dropdown-panel,
[data-theme="dark"] .ai-features-dropdown-panel {
    background: #111827 !important;
    border-color: #1F2937 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
}

.features-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 6px 8px;
    font-size: 10px;
    font-weight: 800;
    color: var(--gemini-muted-text);
    letter-spacing: 0.5px;
    border-bottom: 1px dashed var(--gemini-border);
    margin-bottom: 4px;
}

.features-dropdown-header .badge-tag {
    font-size: 9px;
    padding: 2px 6px;
    background: #ECFDF5;
    color: #059669;
    border-radius: 9999px;
    font-weight: 700;
}

body.dark-theme .features-dropdown-header .badge-tag,
[data-theme="dark"] .features-dropdown-header .badge-tag {
    background: rgba(5, 150, 105, 0.2) !important;
    color: #6EE7B7 !important;
}

.features-dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.feature-item-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    font-family: inherit;
    color: var(--gemini-canvas-text);
}

.feature-item-btn:hover {
    background: rgba(5, 150, 105, 0.08);
    transform: translateX(3px);
}

.feature-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.feature-item-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.feature-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--gemini-canvas-text);
}

.feature-desc {
    font-size: 10.5px;
    color: var(--gemini-muted-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Messages Viewport */
.gemini-messages-viewport {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.gemini-messages-inner {
    max-width: 840px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Welcome Hero */
.gemini-welcome-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 14px 14px 14px;
    animation: fadeIn 0.4s ease;
}

.gemini-hero-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 22px;
    margin-bottom: 10px;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.25);
}

.gemini-hero-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--gemini-canvas-text);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.gemini-hero-subtitle {
    font-size: 13px;
    color: var(--gemini-muted-text);
    max-width: 540px;
    line-height: 1.5;
    margin-bottom: 18px;
}

.gemini-hero-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 760px;
}

.gemini-hero-card {
    background: var(--gemini-hero-card-bg);
    border: 1.5px solid var(--gemini-border);
    border-radius: 14px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.gemini-hero-card:hover {
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(5, 150, 105, 0.15);
    background: var(--gemini-hero-card-hover);
}

.gemini-hero-card-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.gemini-hero-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gemini-canvas-text);
}

.gemini-hero-card-prompt {
    font-size: 11.5px;
    color: var(--gemini-muted-text);
    line-height: 1.4;
}

/* ==========================================================================
   4. CHAT ASSISTANT STREAM & MESSAGE BUBBLES
   ========================================================================== */
#chat-assistant,
.gemini-chat-canvas #chat-assistant {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.ai-msg {
    position: relative;
    display: flex;
    margin-bottom: 14px;
    animation: msgFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    width: 100%;
}

.ai-msg.user-msg {
    justify-content: flex-end;
}

.ai-avatar-icon,
.user-avatar-icon {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
}

.ai-msg.user-msg .chat-bubble-wrapper {
    align-items: flex-end;
    max-width: 82%;
    margin-left: auto;
}

.ai-msg:not(.user-msg) .chat-bubble-wrapper {
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
}

.ai-msg.user-msg .msg-action-bar,
.ai-msg.user-msg .hold-progress-bar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.chat-bubble {
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: text;
    -webkit-user-select: text;
}

.ai-msg.user-msg .chat-bubble {
    background: var(--gemini-user-bubble-bg);
    color: var(--gemini-canvas-text);
    border: 1px solid var(--gemini-user-bubble-border);
    border-radius: 16px 16px 4px 16px;
    width: fit-content;
    padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-msg:not(.user-msg) .chat-bubble {
    background: var(--gemini-ai-bubble-bg);
    color: var(--gemini-canvas-text);
    border: 1px solid var(--gemini-border);
    border-radius: 16px;
    width: 100%;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* 2-Second Hold / Press Feedback */
.ai-msg.holding-press .chat-bubble {
    transform: scale(0.985);
    filter: brightness(0.95);
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.5) !important;
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.ai-msg .hold-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #059669, #10B981, #34D399);
    border-radius: 0 0 8px 8px;
    transition: width 2s linear;
    pointer-events: none;
    opacity: 0;
    z-index: 5;
}

.ai-msg.holding-press .hold-progress-bar {
    width: 100%;
    opacity: 1;
}

/* Action Bar */
.msg-action-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    opacity: 0.25;
    transition: opacity 0.2s ease, max-height 0.2s ease;
}

.ai-msg:hover .msg-action-bar,
.ai-msg.show-actions .msg-action-bar {
    opacity: 1;
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--gemini-muted-text);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
}

.msg-action-btn:hover {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

/* ==========================================================================
   5. BOTTOM INPUT DOCK & CONTROLS
   ========================================================================== */
.gemini-input-dock {
    position: relative;
    flex-shrink: 0;
    background: var(--gemini-input-dock-gradient);
    padding: 8px 16px max(10px, env(safe-area-inset-bottom)) 16px;
    z-index: 20;
    border-top: 1px solid var(--gemini-border);
    transition: background 0.25s ease;
}

.gemini-input-dock-inner {
    max-width: 840px;
    margin: 0 auto;
    width: 100%;
}

.gemini-input-card {
    background: var(--gemini-input-card-bg);
    border: 1.5px solid var(--gemini-border);
    border-radius: 18px;
    padding: 8px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
}

.gemini-input-card:focus-within {
    border-color: #059669;
    box-shadow: 0 12px 35px rgba(5, 150, 105, 0.18);
}

.gemini-textarea {
    width: 100%;
    min-height: 44px;
    max-height: 140px;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--gemini-canvas-text);
    line-height: 1.5;
    padding: 4px 0;
}

/* Quick Math Bar */
.gemini-quick-math-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    padding: 0 2px;
    max-height: 0;
    opacity: 0;
    border-bottom: none;
    margin-bottom: 0;
    transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, padding 0.25s ease, margin-bottom 0.25s ease;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.gemini-quick-math-bar.show {
    max-height: 48px;
    opacity: 1;
    padding: 4px 2px 6px 2px;
    border-bottom: 1px solid var(--gemini-border);
    margin-bottom: 4px;
}

.gemini-quick-math-bar::-webkit-scrollbar {
    display: none;
}

.math-sym-btn {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--gemini-border);
    background: var(--gemini-surface);
    color: var(--gemini-canvas-text);
    font-family: 'KaTeX_Main', 'Times New Roman', serif;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.math-sym-btn:hover {
    background: #ECFDF5;
    border-color: #10B981;
    color: #059669;
    transform: translateY(-1px);
}

/* Toolbar Controls */
.gemini-input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--gemini-border);
}

.gemini-input-tools-left {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.gemini-dock-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid var(--gemini-border);
    background: var(--gemini-surface);
    color: var(--gemini-muted-text);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gemini-dock-tool-btn:hover,
.gemini-dock-tool-btn.active {
    background: #ECFDF5;
    border-color: #A7F3D0;
    color: #059669;
}

.gemini-send-circle-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #059669;
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(5, 150, 105, 0.35);
}

.gemini-send-circle-btn:hover {
    background: #047857;
    transform: scale(1.05);
    box-shadow: 0 5px 14px rgba(5, 150, 105, 0.45);
}

.gemini-send-circle-btn:disabled {
    background: #94A3B8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.gemini-send-circle-btn.stop-btn {
    background: #EF4444;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

.gemini-send-circle-btn.stop-btn:hover {
    background: #DC2626;
}

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

/* Attached Image Preview */
.gemini-attached-preview {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--gemini-surface);
    border: 1px solid var(--gemini-border);
    border-radius: 12px;
    margin-bottom: 8px;
    width: fit-content;
    max-width: 100%;
}

.gemini-attached-thumb {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #94A3B8;
}

.gemini-attached-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gemini-canvas-text);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gemini-attached-remove {
    background: transparent;
    border: none;
    color: #EF4444;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
}

/* Drag and Drop Overlay */
.gemini-drop-overlay {
    display: none;
    position: absolute;
    inset: 12px;
    border: 2.5px dashed #059669;
    background: rgba(5, 150, 105, 0.1);
    backdrop-filter: blur(6px);
    border-radius: 20px;
    z-index: 50;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: #047857;
    font-weight: 800;
    font-size: 16px;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

.gemini-drop-overlay.active {
    display: flex;
}

/* Streaming Typewriter Cursor */
.gemini-streaming-cursor {
    display: inline-block;
    width: 8px;
    height: 18px;
    background: #059669;
    border-radius: 2px;
    margin-left: 4px;
    vertical-align: -2px;
    animation: geminiBlink 0.8s infinite;
}

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

/* Voice Recording Wave Pulse */
.gemini-voice-pulse {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
}

.gemini-voice-bar {
    width: 3px;
    height: 10px;
    background: #EF4444;
    border-radius: 2px;
    animation: geminiVoiceWave 0.6s infinite ease-in-out alternate;
}
.gemini-voice-bar:nth-child(2) { animation-delay: 0.15s; height: 16px; }
.gemini-voice-bar:nth-child(3) { animation-delay: 0.3s; height: 12px; }
.gemini-voice-bar:nth-child(4) { animation-delay: 0.45s; height: 18px; }

@keyframes geminiVoiceWave {
    0% { transform: scaleY(0.4); }
    100% { transform: scaleY(1.3); }
}

/* Code Blocks */
.gemini-code-block-wrapper {
    border-radius: 12px;
    overflow: hidden;
    margin: 12px 0;
    border: 1px solid #1E293B;
    background: #0B0F19;
}

.gemini-code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    background: #151E2E;
    color: #94A3B8;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gemini-copy-code-btn {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.gemini-copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.gemini-code-block-wrapper pre {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    color: #F8FAFC;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* KaTeX Formulas Safeguard */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0;
    max-width: 100%;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

/* Sidebar Backdrop */
.gemini-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 95;
    transition: opacity 0.25s ease;
}

.gemini-sidebar-backdrop.active {
    display: block;
}

/* Skeleton Loaders */
.gemini-history-skeleton {
    height: 34px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

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

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

/* ==========================================================================
   6. RESPONSIVE BREAKPOINTS (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 900px) {
    .gemini-history-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 295px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        margin-left: 0 !important;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
        z-index: 105;
    }

    .gemini-history-sidebar.open {
        transform: translateX(0);
    }

    #sidebar-close-mobile-btn {
        display: inline-flex !important;
    }

    .gemini-hero-cards-grid {
        grid-template-columns: 1fr;
    }

    .gemini-hero-title {
        font-size: 22px;
    }

    .gemini-canvas-header {
        padding: 0 14px;
    }

    .gemini-messages-viewport {
        padding: 14px 12px;
    }

    .gemini-input-dock {
        padding: 8px 12px max(12px, env(safe-area-inset-bottom)) 12px;
    }
}

@media (max-width: 640px) {
    .gemini-canvas-header {
        height: 50px;
        padding: 0 10px;
    }

    .gemini-header-left {
        gap: 6px;
    }

    .gemini-header-right {
        gap: 4px;
    }

    .gemini-header-back-btn {
        padding: 6px 10px;
        font-size: 12px;
        gap: 5px;
    }

    .gemini-header-icon-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .gemini-model-pill {
        padding: 5px 10px;
        font-size: 11.5px;
        max-width: 140px;
    }

    .gemini-model-pill #active-mode-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 90px;
    }

    .ai-features-dropdown-panel {
        width: min(300px, calc(100vw - 20px)) !important;
        max-width: 95vw;
        left: 0 !important;
        right: auto !important;
    }

    .d-none-mobile {
        display: none !important;
    }

    .ai-msg {
        margin-bottom: 12px;
    }

    .ai-avatar-icon, .user-avatar-icon {
        display: none !important;
    }

    .chat-bubble {
        font-size: 13.5px;
        padding: 10px 12px !important;
    }

    .ai-msg.user-msg .chat-bubble {
        max-width: 92%;
    }

    .gemini-messages-viewport {
        padding: 10px 8px;
    }

    .gemini-input-dock {
        padding: 6px 8px max(10px, env(safe-area-inset-bottom)) 8px;
    }

    .gemini-input-card {
        padding: 8px 10px;
        border-radius: 16px;
    }

    .gemini-textarea {
        font-size: 13.5px;
        min-height: 38px;
    }

    .gemini-dock-tool-btn {
        padding: 5px 10px;
        font-size: 11px;
    }

    .gemini-send-circle-btn {
        width: 32px;
        height: 32px;
    }

    .gemini-disclaimer {
        font-size: 10px;
    }
}
