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

:root {
    --bg-color: #F8FAFC;
    --surface-color: #FFFFFF;
    --sidebar-bg: #0F172A;
    --sidebar-border: #1E293B;
    --sidebar-text: #94A3B8;
    --sidebar-text-hover: #F1F5F9;
    --sidebar-text-active: #FFFFFF;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(99, 102, 241, 0.16);
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --primary-color: #6366F1;
    --primary-hover: #4F46E5;
    --primary-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --primary-pill: #EEF2FF;
    --primary-pill-text: #4338CA;
    --border-color: #E2E8F0;
    --hover-bg: #F1F5F9;
    --selected-bg: #EEF2FF;
    --card-bg: #FFFFFF;
    --danger-color: #EF4444;
    --success-color: #10B981;
    --shadow-1: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-2: 0 4px 14px 0 rgba(15, 23, 42, 0.10), 0 2px 4px 0 rgba(15, 23, 42, 0.04);
    --shadow-menu: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ─────────────────────────────────────────────────────────────
   SIDEBAR (Modern SaaS Dark Slate)
   ───────────────────────────────────────────────────────────── */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    padding: 20px 14px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
    user-select: none;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.sidebar .logo {
    font-size: 17px;
    font-weight: 700;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.sidebar .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modern SaaS Gradient Action Button */
.btn-new-saas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary-gradient);
    color: #FFFFFF;
    border: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
    width: 100%;
}

.btn-new-saas:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
    opacity: 0.95;
}

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

/* Navigation List (SaaS Sleek Items) */
.nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    text-decoration: none;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.nav li a:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
}

.nav li a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 600;
}

.nav li a.active .nav-svg {
    stroke: #818CF8;
}

.nav-svg {
    stroke: var(--sidebar-text);
    flex-shrink: 0;
    transition: stroke 0.15s ease;
}

.nav li a:hover .nav-svg {
    stroke: var(--sidebar-text-hover);
}

.nav-admin-link {
    color: #A5B4FC !important;
}

/* Sidebar Storage Widget (Dark Minimalist) */
.sidebar-storage {
    padding: 14px 10px 4px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.storage-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--sidebar-text);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.storage-meter {
    height: 5px;
    background: #1E293B;
    border-radius: 3px;
    overflow: hidden;
}

.storage-meter .fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.storage-details {
    font-size: 11.5px;
    color: var(--sidebar-text);
}

.btn-outline-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: #E2E8F0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    width: 100%;
}

.btn-outline-pill:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #475569;
    color: #FFFFFF;
}

/* Sidebar User Profile Card (SaaS Dark Panel) */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 10px;
    margin-top: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-user-card:hover {
    background: #273549;
    border-color: #475569;
}

.sidebar-user-card .avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary-gradient);
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
}

.sidebar-user-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-align: left;
}

.sidebar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #F8FAFC;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-user-email {
    font-size: 11px;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.logout-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    background: transparent;
    transition: all 0.15s ease;
}

.logout-icon-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #F87171;
}

/* ─────────────────────────────────────────────────────────────
   MAIN CONTENT AREA
   ───────────────────────────────────────────────────────────── */
.main-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

/* Header Topbar (Modern SaaS Clean) */
.topbar {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
}

/* Search Bar (Linear / Supabase Style) */
.search-container {
    position: relative;
    width: min(580px, 45vw);
    display: flex;
    align-items: center;
}

.search-bar {
    width: 100%;
    height: 38px;
    padding: 0 68px 0 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    background-color: #F8FAFC;
    font-size: 13.5px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-bar:focus {
    background-color: #FFFFFF;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon-left {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-shortcut-badge {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 3px;
    pointer-events: none;
}

.search-shortcut-badge kbd {
    font-size: 10.5px;
    font-weight: 600;
    font-family: inherit;
    color: #64748B;
    background: #E2E8F0;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.2;
}

/* Header Right Actions */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-btn:hover {
    background-color: #F1F5F9;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.gemini-action-btn {
    color: #6366F1 !important;
}

.gemini-action-btn:hover {
    background-color: #EEF2FF !important;
    border-color: #C7D2FE !important;
}

.btn-upgrade-saas {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
    transition: all 0.15s ease;
}

.btn-upgrade-saas:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.avatar {
    width: 34px;
    height: 34px;
    background: var(--primary-gradient);
    color: #FFFFFF;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ─────────────────────────────────────────────────────────────
   MAIN PAGE CONTENT
   ───────────────────────────────────────────────────────────── */
.content-body {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
    background-color: #FFFFFF;
}

/* Promotional Blue Access Banner */
.promo-banner {
    background-color: #D3E3FD;
    color: #041E49;
    border-radius: 16px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    font-size: 14px;
    box-shadow: inset 0 0 0 1px rgba(11,87,208,0.1);
}

.promo-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.promo-banner-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.promo-banner a {
    color: #0B57D0;
    font-weight: 500;
    text-decoration: none;
}

.btn-banner-primary {
    background-color: #0B57D0;
    color: #FFFFFF;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-banner-primary:hover {
    background-color: #0842A0;
}

.btn-banner-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #041E49;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
}

.btn-banner-close:hover {
    background-color: rgba(0,0,0,0.06);
}

/* View Header & Title (Linear Clean) */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.4px;
}

.info-icon {
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

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

/* Dynamic Multi-Selection Toolbar (Modern Floating SaaS Pill) */
.selection-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #0F172A;
    color: #FFFFFF;
    border-radius: 12px;
    padding: 8px 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3);
    animation: toolbarSlideIn 0.2s ease-out;
}

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

.selection-toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #F8FAFC;
}

.selection-toolbar-left .icon-btn {
    color: #94A3B8;
}

.selection-toolbar-left .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.selection-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.selection-toolbar-actions .icon-btn {
    color: #94A3B8;
}

.selection-toolbar-actions .icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.btn-gemini-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.2);
    color: #A5B4FC;
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-gemini-pill:hover {
    background: rgba(99, 102, 241, 0.35);
    color: #FFFFFF;
}

/* View Segmented Toggle Controls (List vs Grid) */
.view-toggle-group {
    display: inline-flex;
    background: #F1F5F9;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.view-toggle-btn {
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-toggle-btn.active {
    background: #FFFFFF;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Section Header (e.g. Suggested Files) */
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────
   LIST VIEW & GRID VIEW STYLES
   ───────────────────────────────────────────────────────────── */

/* List View Table */
.file-list-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.file-list-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

.file-list-table tr.item-row {
    cursor: pointer;
    transition: background 0.12s ease;
}

.file-list-table tr.item-row td {
    border-bottom: 1px solid #F1F5F9;
    padding: 12px 14px;
    vertical-align: middle;
    color: var(--text-primary);
}

.file-list-table tr.item-row:hover td {
    background-color: var(--hover-bg);
}

.file-list-table tr.item-row.selected td {
    background-color: var(--selected-bg);
}

.cell-name {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.file-type-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.reason-tag {
    color: var(--primary-color);
    font-size: 12.5px;
}

/* Grid View Cards (Modern Clean Borders) */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.item-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    position: relative;
    box-shadow: var(--shadow-1);
}

.item-card:hover {
    background: #FFFFFF;
    border-color: #CBD5E1;
    box-shadow: var(--shadow-2);
    transform: translateY(-2px);
}

.item-card.selected {
    background: var(--selected-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.item-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-card-preview {
    height: 120px;
    background: #FFFFFF;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    border: 1px solid #E0E3E7;
    overflow: hidden;
}

.item-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-card-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────
   NESTED MATERIAL 3 CONTEXT MENUS
   ───────────────────────────────────────────────────────────── */
.context-menu {
    position: fixed;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: var(--shadow-menu);
    padding: 6px 0;
    z-index: 1000;
    min-width: 220px;
    user-select: none;
    animation: menuFadeIn 0.15s ease-out;
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    font-size: 14px;
    color: #1F1F1F;
    cursor: pointer;
    transition: background 0.1s;
    position: relative;
}

.menu-item:hover {
    background-color: #F1F5F9;
}

.menu-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item-shortcut {
    font-size: 12px;
    color: #747775;
}

.menu-item.danger-item {
    color: var(--danger-color);
}

.menu-divider {
    height: 1px;
    background-color: #E0E3E7;
    margin: 6px 0;
}

/* Secondary Submenu Popout */
.context-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: var(--shadow-menu);
    padding: 6px 0;
    min-width: 200px;
    display: none;
    z-index: 1001;
}

.menu-item:hover > .context-submenu {
    display: block;
}


/* ─────────────────────────────────────────────────────────────
   MODALS & OVERLAYS
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.32);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: #FFFFFF;
    width: min(480px, 90vw);
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--shadow-2);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

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

.modal h3 {
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #747775;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border 0.15s;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(11, 87, 208, 0.2);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
}

.btn-text:hover {
    background: rgba(11, 87, 208, 0.08);
}

.btn-filled {
    background: var(--primary-color);
    border: none;
    color: #FFFFFF;
    padding: 10px 24px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
}

.btn-filled:hover {
    background: var(--primary-hover);
}

/* ─────────────────────────────────────────────────────────────
   MOBILE NAVIGATION, DOCK & DRAWER CONTROLS
   ───────────────────────────────────────────────────────────── */
.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close-btn {
    display: none;
    width: 36px;
    height: 36px;
    font-size: 16px;
    color: var(--text-secondary);
}

.sidebar-toggle-btn {
    display: none;
    width: 40px;
    height: 40px;
    margin-right: 6px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}



.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 3400;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-fab {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--primary-gradient);
    color: #FFFFFF;
    border: none;
    font-size: 26px;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 3000;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.mobile-fab:hover {
    transform: scale(1.05);
    opacity: 0.95;
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.55);
}

.mobile-fab:active {
    transform: scale(0.95);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN (Tablets & Mobile)
   ───────────────────────────────────────────────────────────── */

/* Viewports <= 992px: Sidebars become drawers, topbar adapts */
@media (max-width: 992px) {
    #app {
        position: relative;
    }

    .sidebar-toggle-btn {
        display: flex !important;
    }

    /* Left Sidebar as Off-Canvas Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 3500;
        background-color: var(--sidebar-bg);
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 28px rgba(0, 0, 0, 0.28);
    }

    .sidebar.mobile-open .sidebar-close-btn {
        display: flex !important;
    }

    .main-layout {
        margin-top: 0;
        border-radius: 0;
        width: 100%;
        min-width: 0;
    }

    .search-container {
        width: 100%;
        max-width: none;
        flex: 1;
    }
}

/* Viewports <= 768px: Mobile layouts, table columns, FAB */
@media (max-width: 768px) {
    .topbar {
        height: 56px;
        padding: 0 12px;
        gap: 6px;
    }

    .search-bar {
        padding: 8px 34px 8px 36px;
        font-size: 13px;
    }

    .search-icon-left {
        font-size: 14px;
        left: 12px;
    }

    .search-icon-right {
        font-size: 14px;
        right: 12px;
    }

    /* Hide non-essential desktop buttons on small screens */
    .btn-upgrade-saas,
    .btn-upgrade-pill,
    .search-shortcut-badge,
    .topbar-actions button[title="Ready status"],
    .topbar-actions button[title="Help"] {
        display: none !important;
    }

    .topbar-actions {
        gap: 4px;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .content-body {
        padding: 12px;
    }

    .view-header {
        margin-bottom: 12px;
    }

    .page-title {
        font-size: 18px;
    }

    /* Show floating action button for quick creation */
    .mobile-fab {
        display: flex;
    }

    /* Floating selection toolbar for mobile */
    .selection-toolbar {
        bottom: 84px;
        left: 12px;
        right: 12px;
        transform: none;
        max-width: none;
        width: auto;
        padding: 8px 12px;
        border-radius: 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .selection-toolbar-left {
        justify-content: space-between;
    }

    .selection-toolbar-actions {
        justify-content: space-around;
        width: 100%;
        overflow-x: auto;
    }

    /* Responsive File List Table: hide owner & modified date on mobile */
    .file-list-table th:nth-child(2),
    .file-list-table td:nth-child(2),
    .file-list-table th:nth-child(3),
    .file-list-table td:nth-child(3) {
        display: none;
    }

    .file-list-table th,
    .file-list-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Responsive File Grid */
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .grid-card {
        padding: 10px;
        border-radius: 12px;
    }

    .grid-card-preview {
        height: 90px;
    }

    /* Responsive Upload Widget */
    #upload-widget {
        width: calc(100% - 24px) !important;
        left: 12px !important;
        right: 12px !important;
        bottom: 84px !important;
        border-radius: 14px !important;
    }

    /* Responsive Modal Dialogs */
    .modal {
        width: calc(100% - 24px) !important;
        max-height: 92vh;
        overflow-y: auto;
        padding: 20px 16px;
        border-radius: 20px;
    }

    .modal-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Viewports <= 480px: Extra compact mobile screens */
@media (max-width: 480px) {
    .topbar {
        padding: 0 8px;
        gap: 4px;
    }

    .topbar-actions button[title="Gemini AI"] {
        display: none !important;
    }

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

    .file-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .context-menu {
        max-width: calc(100vw - 24px);
    }
}

/* ─────────────────────────────────────────────────────────────
   SETTINGS PANEL
   ───────────────────────────────────────────────────────────── */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(480px, 92vw);
    height: 100vh;
    background: #FFFFFF;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px 0 0 0;
}

.settings-panel.open {
    transform: translateX(0);
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.settings-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.settings-tab:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.settings-tab.active {
    background: var(--primary-pill);
    color: var(--primary-pill-text);
    font-weight: 600;
}

.s-group {
    margin-bottom: 16px;
}

.s-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ─────────────────────────────────────────────────────────────
   GEMINI AI PANEL
   ───────────────────────────────────────────────────────────── */
.gemini-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 92vw);
    height: 100vh;
    background: #FFFFFF;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px 0 0 0;
}

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

.gemini-panel-header {
    background: linear-gradient(135deg, #8B5CF6, #4A6CF7);
    color: #FFFFFF;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 24px 0 0 0;
}

.gemini-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gemini-panel-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.gemini-panel-header button:hover {
    background: rgba(255,255,255,0.35);
}

.gemini-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gemini-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: messageFadeIn 0.25s ease-out;
}

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

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.gemini-message.user {
    align-self: flex-end;
    background: #4A6CF7;
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.gemini-message.ai {
    align-self: flex-start;
    background: #F1F5F9;
    color: #1F1F1F;
    border-bottom-left-radius: 4px;
}

.gemini-message.ai .gemini-context-badge {
    display: inline-block;
    font-size: 11px;
    background: #E0E3E7;
    color: #444746;
    padding: 2px 8px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.gemini-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 12px;
}

.gemini-suggestion-chip {
    padding: 6px 12px;
    background: #F8FAFD;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.gemini-suggestion-chip:hover {
    background: #EDF2FC;
    border-color: #C2E7FF;
    color: #0B57D0;
}

.gemini-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.gemini-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #747775;
    border-radius: 20px;
    font-size: 14px;
    resize: none;
    outline: none;
    font-family: inherit;
    min-height: 40px;
    max-height: 120px;
    transition: border 0.15s;
}

.gemini-input-area textarea:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.gemini-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #8B5CF6, #4A6CF7);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.gemini-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.gemini-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
