/* ================================================================
   Company Cloud Drive — Material Design / Google Drive Style
   All IDs & JS functions are preserved. Only visual redesign.
   ================================================================ */

/* ---------- Reset & Typography ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --md-primary: #1a73e8;
    --md-primary-dark: #1557b0;
    --md-on-primary: #fff;
    --md-surface: #ffffff;
    --md-surface-2: #f8f9fa;
    --md-background: #f0f2f5;
    --md-on-surface: #202124;
    --md-on-surface-variant: #5f6368;
    --md-divider: #dadce0;
    
    /* Elevation shadow system */
    --elevation-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --elevation-2: 0 1px 2px 0 rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
    --elevation-3: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    
    /* Status colours */
    --md-success: #0d904f;
    --md-error: #d93025;
    --md-warn: #e37400;
}

html { font-size: 14px; }

body {
    font-family: 'Google Sans', Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--md-background);
    color: var(--md-on-surface);
    overflow: hidden;
    height: 100vh;
}

/* ===================== LOGIN PAGE ===================== */
.page-section {
    position: fixed; inset: 0; z-index: 2000;
    display: none;
    background: #fff;
}
.page-section.active { display: flex !important; }

.login-bg {
    background: linear-gradient(135deg, #e8f0fe 0%, #d2e3fc 50%, #aecbfa 100%);
}

.login-container {
    position: relative; z-index: 1;
    display: flex; justify-content: center; align-items: center;
    width: 100%; height: 100%;
}

.login-card {
    width: 392px; padding: 48px 40px 36px;
    border: 1px solid var(--md-divider);
    border-radius: 8px;
    text-align: center;
    background: #fff;
}

.login-logo {
    width: 56px; height: 56px; margin: 0 auto 24px;
    font-size: 32px; color: var(--md-primary);
    display: flex; align-items: center; justify-content: center;
    background: #e8f0fe; border-radius: 12px;
}

.login-card h2 {
    font-size: 24px !important;
    font-weight: 400 !important;
    color: var(--md-on-surface);
    margin-bottom: 32px !important;
}

.login-card .login-card p {
    color: var(--md-on-surface-variant) !important;
    margin-bottom: 32px !important;
}

/* --- Material Input Fields --- */
.input-group {
    text-align: left; margin-bottom: 20px;
}

.input-group label, .form-field label {
    display: block;
    font-size: 12px; font-weight: 500;
    color: var(--md-on-surface-variant);
    margin-bottom: 4px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input,
.form-field input[type="text"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
    width: 100%; padding: 12px 16px;
    border: 1px solid var(--md-divider);
    border-radius: 4px;
    font-family: inherit; font-size: 16px;
    background: var(--md-surface);
    transition: border-color .2s, box-shadow .2s;
}

.input-wrapper input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--md-primary);
    border-width: 2px;
    padding: 11px 15px; /* compensate for thicker border */
}

.input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--md-on-surface-variant); font-size: 18px;
    pointer-events: none;
}

.input-wrapper input { padding-left: 42px !important; }

/* --- Login Button (Material) --- */
.btn-login {
    width: 100%; padding: 13px 24px; margin-top: 16px;
    background: var(--md-primary); color: #fff;
    border: none; border-radius: 4px;
    font-size: 15px; font-weight: 500;
    cursor: pointer;
    transition: .2s;
}
.btn-login:hover { background: var(--md-primary-dark); box-shadow: var(--elevation-1); }

.login-error {
    color: var(--md-error) !important; margin-top: 16px !important;
    font-size: 13px; text-align: center; min-height: 20px;
}

.login-footer-text {
    margin-top: 48px;
    color: var(--md-on-surface-variant);
    font-size: 12px;
}

/* ===================== APP LAYOUT ===================== */

/* --- Top Bar (Google Drive style) --- */
#main-app { display: none; flex-direction: column; height: 100vh; }

.top-bar {
    height: 64px; background: var(--md-surface);
    border-bottom: 1px solid var(--md-divider);
    display: flex; align-items: center; padding: 0 16px; gap: 12px;
}

.top-bar-left {
    display: flex; align-items: center; gap: 16px; min-width: 240px;
}

/* Hamburger menu (when sidebar is collapsed) */
.menu-btn {
    background: none; border: none; cursor: pointer;
    padding: 8px; border-radius: 50%;
    color: var(--md-on-surface-variant); font-size: 18px;
    transition: .2s;
}
.menu-btn:hover { background: rgba(0,0,0,.06); }

/* Logo in top bar */
.top-logo {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none !important; color: inherit;
    cursor: pointer;
}

.logo-icon { font-size: 28px; color: var(--md-primary); }
.logo-text {
    font-size: 22px; color: var(--md-on-surface-variant);
    font-weight: 400; white-space: nowrap;
}

/* --- Search Bar (pill-shaped) --- */
.top-search {
    flex: 1; max-width: 720px; margin: 0 auto;
}

.search-wrapper {
    position: relative; display: flex; align-items: center;
}

.search-wrapper input {
    width: 100%; padding: 12px 16px 12px 48px;
    background: var(--md-surface-2); border: none;
    border-radius: 24px; font-size: 16px;
    transition: .2s;
}

.search-wrapper input:focus {
    outline: none;
    background: #fff; box-shadow: var(--elevation-1);
}

.search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--md-on-surface-variant); font-size: 20px;
    pointer-events: none;
}

/* --- Right section of top bar --- */
.top-bar-right {
    display: flex; align-items: center; gap: 8px; margin-left: auto;
}

.icon-btn {
    background: none; border: none; cursor: pointer;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--md-on-surface-variant); font-size: 20px;
    transition: .15s;
}
.icon-btn:hover { background: rgba(0,0,0,.06); }

.user-menu {
    display: flex; align-items: center; gap: 8px; padding: 4px;
    cursor: pointer; border-radius: 20px; transition: .15s;
}
.user-menu:hover { background: rgba(0,0,0,.06); }

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--md-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 500;
}

.user-info-desktop { display: flex; flex-direction: column; }
.user-name { font-size: 13px; color: var(--md-on-surface); font-weight: 500; }
.user-role { font-size: 11px; color: var(--md-on-surface-variant); }

.dropdown-arrow { background: none; border: none; cursor: pointer; padding: 4px; color: var(--md-on-surface-variant); }

/* ===================== APP BODY ===================== */
.app-body {
    display: flex; flex: 1; overflow: hidden;
}

/* ---------- LEFT SIDEBAR ---------- */
.sidebar {
    width: 256px; background: #fff;
    display: flex; flex-direction: column; padding: 8px 12px;
    border-right: 1px solid var(--md-divider);
    transition: width .3s ease, padding .3s ease;
}

/* Collapsed sidebar */
.sidebar.collapsed {
    width: 72px; padding: 8px 4px;
}
.sidebar.collapsed .nav-text,
.sidebar.collapsed .create-section,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-separator { display: none !important; }
.sidebar.collapsed a.nav-item { justify-content: center; padding: 10px 0; }

/* Create buttons */
.create-section {
    display: flex; gap: 8px; margin-bottom: 16px;
}

.btn-create {
    flex: 1; padding: 12px;
    background: #e8f0fe; border: none; border-radius: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px;
    font-size: 14px; font-weight: 500; color: var(--md-primary);
    transition: .2s; box-shadow: var(--elevation-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-create i { font-size: 18px; }

.btn-create:hover {
    background: #d2e3fc;
    box-shadow: var(--elevation-2);
}

.btn-create-secondary {
    background: #fff; color: var(--md-on-surface-variant);
    box-shadow: var(--elevation-1);
}

/* Navigation items */
.side-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 16px; padding: 0 24px;
    text-decoration: none !important; color: var(--md-on-surface);
    font-size: 14px; border-radius: 0 24px 24px 0;
    min-height: 48px; transition: .2s; white-space: nowrap;
}
.nav-item:hover { background: #f1f3f4; }

/* Active state */
.nav-item.active {
    background: #e8f0fe; color: var(--md-primary); font-weight: 600;
}

.nav-icon {
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 22px !important;
}

/* Admin section */
.admin-panel { margin-top: 8px; }

.nav-separator {
    border: none; border-top: 1px solid var(--md-divider);
    margin: 16px 0 12px;
}

.nav-label {
    font-size: 11px; font-weight: 500; text-transform: uppercase;
    letter-spacing: .8px; color: var(--md-on-surface-variant);
    padding: 0 24px; margin-bottom: 8px;
}

/* ===================== MAIN CONTENT AREA ===================== */
.main-content {
    flex: 1; overflow-y: auto; padding: 16px 32px 32px;
    background: var(--md-background);
}

/* --- Breadcrumb --- */
.breadcrumb-bar {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--md-on-surface-variant);
    margin-bottom: 16px; min-height: 60px; /* reserve height */
}

.breadcrumb-bar a {
    text-decoration: none !important; color: inherit;
    cursor: pointer; transition: .2s;
}
.breadcrumb-bar a:hover { color: var(--md-primary); }

/* --- File View Styles --- */
.files-header {
    margin-bottom: 16px; min-height: 56px;
}

.files-header h1 {
    font-size: 24px !important; font-weight: 400 !important; color: var(--md-on-surface);
    display: flex; align-items: center; gap: 8px;
}

.toolbar-row {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px; min-height: 48px;
}

.action-btn {
    padding: 10px 24px; font-size: 14px;
    border: none; border-radius: 4px; cursor: pointer;
    transition: .15s; display: flex; align-items: center; gap: 8px;
}

.action-btn:not(.btn-sm) {
    background: var(--md-primary); color: #fff;
    font-weight: 500;
}
.action-btn:not(.btn-sm):hover {
    background: var(--md-primary-dark); box-shadow: var(--elevation-1);
}

.btn-sm { background: unset !important; padding: 10px !important; border-radius: 50% !important; color: var(--md-on-surface-variant) !important; }
.btn-sm:hover { background: rgba(0,0,0,.06) !important; }

/* ===================== FILE GRID (Google Drive style tiles) ===================== */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px; padding: 8px 0;
}

/* File Card — Google-style tile (no border, subtle hover) */
.file-card {
    background: var(--md-surface);
    border: none; border-radius: 8px;
    position: relative; cursor: pointer;
    transition: box-shadow .15s; display: flex; flex-direction: column;
}

.file-card:hover {
    box-shadow: var(--elevation-2);
}

.file-card::before {
    content: ''; width: 100%; height: 4px; border-radius: 8px 8px 0 0;
    background: transparent; transition: .3s;
}

.file-card.folder:hover::before { background: #d2e3fc; }
.file-card.file-card-image::before { background: var(--md-primary); }
.file-card.file-card-pdf::before { background: #c5221f; }
.file-card.file-card-doc::before { background: #1a73e8; }
.file-card.file-card-video::before { background: rgba(60,64,67,.3); }

/* Icon area (centered) */
.card-header {
    padding: 24px 16px 12px; height: 80px;
    display: flex; align-items: center; justify-content: center;
    font-size: 56px; color: var(--md-on-surface-variant);
}

.file-card.folder .card-header { color: #f9ab00; }
.file-card-image .card-header { color: var(--md-primary); }
.file-card-pdf .card-header { color: #c5221f; }
.file-card-doc .card-header { color: #1a73e8; }
.file-card-video .card-header { color: rgba(60,64,67,.7); }

/* Card content (bottom strip) */
.card-content {
    padding: 8px 16px 12px; min-height: 52px;
}

.file-name {
    font-size: 13px !important; font-weight: 400 !important;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.file-meta {
    font-size: 11px !important; color: var(--md-on-surface-variant) !important;
}

/* Quick Actions overlay (hover only) */
.card-actions {
    position: absolute; top: 4px; right: 4px; opacity: 0;
    transition: .2s; z-index: 10;
}

.file-card:hover .card-actions { opacity: 1; }

.card-actions button,
.card-actions a.btn-action {
    width: 32px !important; height: 32px !important; min-width: 32px !important;
    border-radius: 50% !important; border: none !important;
    background: #fff !important; box-shadow: var(--elevation-1) !important;
    cursor: pointer !important; display: flex !important; align-items: center; justify-content: center;
    font-size: 14px !important; color: var(--md-on-surface-variant) !important;
}

.card-actions button:hover,
.card-actions a.btn-action:hover { background: #f1f3f4 !important; }

/* ---- Empty state / No results ---- */
.empty-message {
    grid-column: 1/-1; padding: 60px 20px !important;
    text-align: center !important; color: var(--md-on-surface-variant) !important;
    font-size: 14px !important; background: transparent !important;
}
.empty-message::before { content: ''; font-family: 'Material Icons'; font-size: 64px; display: block; margin-bottom: 12px; opacity: .35; }

/* ===================== VIEWS (mutually exclusive sections) ===================== */
.view-section {
    display: none !important;
}
.view-section.active {
    display: block !important;
}

/* ===================== ADMIN VIEWS ===================== */
.admin-view {
    display: none !important;
}
.admin-view.active {
    display: block !important;
}

.admin-view h2 {
    font-size: 24px !important; font-weight: 400 !important; margin: 16px 0 !important; display: flex !important;
    align-items: center !important; gap: 8px !important; color: var(--md-on-surface) !important;
}

.admin-header-row {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}

.btn-add {
    padding: 10px 24px; background: var(--md-primary); color: #fff; border: none;
    border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 8px; transition: .2s;
}
.btn-add:hover { background: var(--md-primary-dark); box-shadow: var(--elevation-1); }

/* ---- Table styles (Material Design) ---- */
.data-table {
    width: 100%; border-collapse: collapse; background: var(--md-surface);
    border-radius: 8px; overflow: hidden; box-shadow: var(--elevation-1); font-size: 13px;
}

.data-table thead tr {
    border-bottom: 1px solid var(--md-divider);
}

.data-table th {
    background: var(--md-surface-2) !important; color: var(--md-on-surface-variant) !important;
    font-weight: 500 !important; text-transform: none !important; letter-spacing: normal !important;
    padding: 14px 16px !important; text-align: left !important;
}

.data-table td {
    padding: 12px 16px !important; border-bottom: 1px solid #f0f0f0 !important; color: var(--md-on-surface) !important; vertical-align: middle !important;
}

.data-table tbody tr:hover { background: #f8f9fa; }
.data-table tbody tr:last-child td { border-bottom: none !important; }


/* Role badges (Material chips) */
.badge-admin, .badge-user {
    display: inline-flex; align-items: center; padding: 4px 12px;
    border-radius: 16px; font-size: 12px; font-weight: 500;
}

.badge-admin { background: #fce8e6; color: #c5221f !important; }
.badge-user   { background: #e8f0fe; color: var(--md-primary) !important; }

.status-active { color: var(--md-success) !important; font-weight: 500 !important; display: inline-flex; align-items: center; gap: 4px; }
.status-active::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.status-disabled { color: var(--md-on-surface-variant) !important; font-weight: 400 !important; }
.status-disabled::before { content: ''; font-family: 'Material Icons'; font-size: 14px; margin-right: 6px; }

/* Delete button in admin table */
.data-table .btn-delete {
    padding: 6px 16px !important; background: var(--md-error) !important;
    border: none !important; color: #fff !important; border-radius: 4px !important;
    cursor: pointer !important; font-size: 13px !important; transition: .2s !important;
}
.data-table .btn-delete:hover { opacity: .85; }

/* ===================== PANEL (Right Preview side panel) ===================== */
.panel-preview {
    width: 0; overflow: hidden; background: var(--md-surface);
    border-left: 1px solid var(--md-divider); flex-shrink: 0; transition: .25s ease;
    display: flex; flex-direction: column;
}
.panel-preview.preview-open { width: 380px; margin-left: auto; }

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--md-divider); flex-shrink: 0;
}

.panel-header h3 { font-size: 15px !important; font-weight: 400 !important; margin: 0 !important; color: var(--md-on-surface); }

.panel-header button { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 4px; color: var(--md-on-surface-variant); font-size: 20px; }
.panel-header button:hover { background: rgba(0,0,0,.06); }

.panel-body { flex: 1; overflow-y: auto; padding: 16px; }

/* ===================== MODALS (Google Dialog style) ===================== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.54); z-index: 3000;
    display: none !important; align-items: center; justify-content: center;
}
.modal-active { display: flex !important; }

.modal-content {
    background: #fff; border-radius: 12px; box-shadow: var(--elevation-3);
    max-height: 90vh; overflow: hidden; display: flex; flex-direction: column;
}

.modal-md { width: 496px; }
.modal-lg { width: 680px; }
.modal-xl { width: 720px; }

/* Modal header */
.modal-header-section {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-bottom: none;
}

.modal-header-section h3 { font-size: 22px !important; font-weight: 400 !important; margin: 0 !important; display: flex; align-items: center; gap: 8px; }

.close-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 50%; color: var(--md-on-surface-variant); font-size: 20px; transition: .2s; }
.close-btn:hover { background: rgba(0,0,0,.06); }

/* Modal body */
.modal-body-section { padding: 8px 24px 24px; overflow-y: auto; flex: 1; }

.center-content { text-align: center; display: flex !important; flex-direction: column; align-items: center; gap: 16px; }
.form-hint { color: var(--md-on-surface-variant); font-size: 14px !important; margin-bottom: 0 !important; }
.input-large { width: 100%; max-width: 400px; text-align: center; padding: 12px 16px; border: none !important; border-bottom: 2px solid var(--md-divider) !important; border-radius: 0 !important; font-size: 16px; background: transparent; transition: .2s; }
.input-large:focus { border-color: var(--md-primary) !important; }
.error-small { color: var(--md-error) !important; font-size: 12px !important; min-height: 18px; }

/* Modal footer */
.modal-footer-section { padding: 0 24px 24px; display: flex; justify-content: flex-end; gap: 8px; }

.btn-cancel { padding: 10px 24px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 500; background: transparent; color: var(--md-primary); transition: .2s; }
.btn-cancel:hover { background: rgba(26,115,232,.08); }

.btn-primary-fill { padding: 10px 24px !important; background: var(--md-primary)!important ; color: #fff!important !important; border: none !important; border-radius: 4px !important; cursor: pointer !important; font-size: 14px !important; font-weight: 500 !important; display: flex; align-items: center; gap: 8px; transition: .2s; }
.btn-primary-fill:hover { background: var(--md-primary-dark) !important; box-shadow: var(--elevation-1); }

/* Upload drop zone */
.upload-drop-zone {
    border: 2px dashed var(--md-divider); border-radius: 8px; padding: 40px 24px; text-align: center; margin-bottom: 20px; cursor: pointer; background: #fafafa; transition: .2s;
}
.upload-drop-zone:hover { border-color: var(--md-primary); background: #f1f8ff; }
.upload-drop-zone.file-selected { border-color: var(--md-success); background: #e6f4ea; }

.file-input-hidden { position: fixed !important; opacity: 0 !important; width: 0 !important; height: 0 !important; }

.drop-content { cursor: pointer; }
.upload-icon { font-size: 48px; color: var(--md-primary); display: block; margin-bottom: 12px; }
.drop-text { font-size: 16px; color: var(--md-on-surface) !important; margin-bottom: 6px !important; }
.drop-hint { color: var(--md-on-surface-variant); }

/* Forms */
.form-row { display: flex; gap: 16px; margin-bottom: 8px; }
.two-col { flex-wrap: wrap; }
.form-field { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.full-width { width: 100%; }
.wide-select select { width: 100%; padding: 12px 16px; border: 2px solid var(--md-divider); border-radius: 4px; font-size: 15px; background: #fff; transition: .2s; appearance: auto; }
.wide-select select:focus { border-color: var(--md-primary); outline: none; box-shadow: inset 2px -2px 0 var(--md-primary); }

/* Share info */
.share-file-info { font-size: 15px !important; background: #fffde7; padding: 12px !important; border-radius: 4px; margin-bottom: 16px !important; color: var(--md-on-surface-variant) !important; }

/* ===================== AI CHAT DRAWER (Right sidebar) ===================== */
.ai-drawer-overlay {
    position: fixed; inset: 0; z-index: 3500;
    pointer-events: none;
}
.ai-drawer-open .ai-drawer-overlay {
    pointer-events: auto;
}
.ai-drawer-open #ai-drawer-overlay {
    background: rgba(0,0,0,.2);
    animation: drawerFadeIn .2s forwards;
}
.ai-drawer-open #ai-drawer {
    right: 0;
}
@keyframes drawerFadeIn { from { opacity: 0 } to { opacity: 1 } }

.ai-drawer {
    position: fixed; top: 52px; right: -420px; bottom: 0;
    width: 400px; max-width: 40vw; min-width: 320px;
    background: #fff; border-left: 1px solid #e0e0e0;
    box-shadow: -2px 0 8px rgba(0,0,0,.12);
    display: flex; flex-direction: column;
    transition: right .3s ease;
    z-index: 3600;
}

.ai-drawer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #e8f0fe 0%, #fce8f0 100%);
}
.ai-drawer-header h3 { margin: 0; font-size: 17px; color: var(--md-primary); white-space: nowrap; }

.close-btn-small {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: #666; padding: 4px 8px; border-radius: 50%;
}
.close-btn-small:hover { background: rgba(0,0,0,.08); }

/* --- Current folder context bar --- */
.ai-context-bar {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 20px; background: #e3f2fd; border-bottom: 1px solid #bbdefb;
    font-size: 13px; color: #1565c0; flex-shrink: 0; overflow-x: auto; white-space: nowrap;
}
.ai-folder-path {
    font-weight: 600; color: #0d47a1; max-width: 260px;
    overflow: hidden; text-overflow: ellipsis;
}

/* --- Search scope selector --- */
.ai-scope-selector {
    display: flex; gap: 16px; padding: 8px 20px;
    background: #f5f5f5; border-bottom: 1px solid #e0e0e0;
    font-size: 12px; color: #444; flex-shrink: 0;
}
.ai-scope-selector label { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.ai-scope-selector input[type="radio"] { margin: 0; }

/* --- Chat area (drawer variant) --- */
.drawer-chat { flex-shrink: 0; }
.ai-chat-drawer { padding: 12px !important; min-height: 200px; max-height: calc(100vh - 380px); font-size: 14px !important; }

/* --- AI answer result card inside drawer chat --- */
.ai-result-card {
    margin-top: 6px; padding: 10px 12px; background: #f5f7fa; border-left: 3px solid var(--md-primary);
    border-radius: 4px; font-size: 13px !important; line-height: 1.5;
}
.ai-result-card .result-file-name { font-weight: 600; color: #1a237e; }
.ai-result-card .result-meta { color: #666; font-size: 12px; }

/* --- AI search result file cards with download buttons --- */
.ai-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.ai-file-item:hover {
    border-color: var(--md-primary);
    box-shadow: 0 1px 4px rgba(26,157,224,0.15);
}
.ai-file-info {
    flex: 1;
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}
.ai-file-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.ai-file-name {
    color: var(--md-primary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    word-break: break-all;
}
.ai-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--md-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    white-space: nowrap;
    transition: background 0.2s;
}
.ai-download-btn:hover {
    opacity: 0.85;
    background: #1565c0;
}

.ai-input-bar input::placeholder { font-style: italic; color: #888; }

/* --- Old modal style (kept for backwards compatibility if something references it) --- */
}

.chat-message { max-width: 85%; padding: 8px 12px; font-size: 13px; line-height: 1.45; }

.chat-message.user { align-self: flex-end; background: #e8f0fe; color: var(--md-on-surface); border-radius: 16px 16px 4px 16px; }
.chat-message.ai   { align-self: flex-start; background: #fff; color: var(--md-on-surface); border-radius: 16px 16px 16px 4px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.chat-message strong { font-weight: 500; display: block; margin-bottom: 4px; }
.ai-chat ul { margin-top: 6px; padding-left: 18px; }
.ai-chat li { margin-bottom: 3px; }
.ai-chat a { color: var(--md-primary); text-decoration: none !important; font-weight: 500; }
.ai-chat a:hover { text-decoration: underline !important; }

.loading-indicator::before { content: '⋯'; animation: typing 1.8s infinite; display: inline-block; width: 3ch; overflow: hidden; }
@keyframes typing { 0%,60% { content: '⋯' } 40% { content: '· ⋯' } 80% { content: '·· ·' } }

.ai-input-bar { display: flex; padding: 12px 16px; gap: 8px; border-top: 1px solid var(--md-divider); background: #fff; align-items: center; }
.ai-input-bar input {
    flex: 1; padding: 10px 16px !important; background: #f4f6f9;border: none; border-radius: 24px !important; font-size: 15px !important; outline: none !important; box-shadow: 0 1px 2px rgba(0,0,0,.06) !important;
}

.btn-send { margin-left: -32px; padding: 6px 14px; color: #fff; }


/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 251, 196); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .sidebar { width: 60px !important; padding: 4px !important; }
    .nav-text, .create-section, .nav-label, .user-info-desktop { display: none !important; }
    .main-content { padding: 12px 16px; }
    .files-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); }
}

/* ===================== MISC UTILITIES ===================== */
.hidden-admin { display: none !important; }


/* ================================================================
   File Properties Modal Styles
   ================================================================ */

.prop-name-input {
    flex: 1;
}

.prop-extension-readonly {
    display: inline-block;
    background: #e8eaed;
    color: #5f6368;
    padding: 10px 12px;
    border: 1px solid #dadce0;
    border-left: none;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    white-space: nowrap;
    user-select: none;
}

/* Tag chips */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--md-primary);
    color: #fff;
    border-radius: 16px;
    font-size: 12px;
    cursor: default;
}

.tag-chip .tag-remove {
    cursor: pointer;
    font-size: 10px;
    opacity: 0.7;
    margin-left: 2px;
    transition: opacity 0.2s;
}

.tag-chip .tag-remove:hover {
    opacity: 1;
}

/* Tag autocomplete */
.autocomplete-item {
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--md-primary-light, #e8f0fe);
}

/* Property modal input wrapper */
.form-field > div[style*="display:flex"] {
    align-items: center;
}
