/* ============================================
   SHARED THEME SYSTEM - File Vault
   ============================================
   This file contains all theme-related CSS variables
   for consistent light/dark mode across all pages.
   ============================================ */

/* ============================================
   DARK THEME (Default)
   ============================================ */
:root {
    /* Backgrounds */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-elevated: #22222f;
    --bg-glass: rgba(18, 18, 26, 0.85);
    --bg-glass-strong: rgba(26, 26, 37, 0.9);
    --bg-gradient-start: #0a0a0f;
    --bg-gradient-end: #0f172a;
    
    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: #9ba3ba;
    --text-muted: #6f7285;
    
    /* Accents - Primary naming */
    --accent: #00d4ff;
    --accent-2: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    /* Accents - Aliases for compatibility */
    --accent-primary: var(--accent);
    --accent-secondary: var(--accent-2);
    --accent-tertiary: var(--accent-success);
    
    /* Borders & Shadows */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(0, 212, 255, 0.15);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #00d4ff 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    
    /* Inputs */
    --input-bg: rgba(18, 18, 26, 0.8);
    --input-border: rgba(255, 255, 255, 0.1);
    --input-focus-border: #00d4ff;
    
    /* Components */
    --card-bg: #12121a;
    --container-bg: #12121a;
    --modal-bg: rgba(0, 0, 0, 0.7);
    --modal-content-bg: #12121a;
    --table-header-bg: linear-gradient(135deg, #00d4ff, #7c3aed);
    --table-hover-bg: #1c1c2b;
    --badge-bg: rgba(0, 212, 255, 0.12);
    --badge-color: #00d4ff;
    
    /* Upload specific */
    --upload-border: #00d4ff;
    --upload-bg-start: rgba(0, 212, 255, 0.08);
    --upload-bg-end: rgba(124, 58, 237, 0.08);
    --upload-bg-hover-start: rgba(0, 212, 255, 0.16);
    --upload-bg-hover-end: rgba(124, 58, 237, 0.16);
    --file-item-bg: #161623;
    --file-item-hover-shadow: rgba(0, 212, 255, 0.25);
    
    /* QR Code */
    --qr-bg: rgba(18, 18, 26, 0.95);
    --qr-border: rgba(124, 58, 237, 0.35);
    
    /* Fonts */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Layout */
    --sidebar-width: 320px;
    --header-height: 64px;
}

/* ============================================
   LIGHT THEME
   ============================================ */
[data-theme="light"] {
    /* Backgrounds */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-elevated: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --bg-glass-strong: rgba(255, 255, 255, 0.97);
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;
    
    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* Accents - Primary naming */
    --accent: #0284c7;
    --accent-2: #7c3aed;
    --accent-success: #059669;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    
    /* Accents - Aliases for compatibility */
    --accent-primary: var(--accent);
    --accent-secondary: var(--accent-2);
    --accent-tertiary: var(--accent-success);
    
    /* Borders & Shadows */
    --border-color: rgba(0, 0, 0, 0.1);
    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.15);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(14, 165, 233, 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #0284c7 100%);
    --gradient-danger: linear-gradient(135deg, #dc2626 0%, #d97706 100%);
    
    /* Inputs */
    --input-bg: rgba(241, 245, 249, 0.9);
    --input-border: rgba(0, 0, 0, 0.1);
    --input-focus-border: #0284c7;
    
    /* Components */
    --card-bg: #ffffff;
    --container-bg: #ffffff;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --modal-content-bg: #ffffff;
    --table-header-bg: linear-gradient(135deg, #0284c7, #7c3aed);
    --table-hover-bg: #f1f5f9;
    --badge-bg: rgba(14, 165, 233, 0.12);
    --badge-color: #0284c7;
    
    /* Upload specific */
    --upload-border: #0284c7;
    --upload-bg-start: rgba(14, 165, 233, 0.08);
    --upload-bg-end: rgba(124, 58, 237, 0.08);
    --upload-bg-hover-start: rgba(14, 165, 233, 0.16);
    --upload-bg-hover-end: rgba(124, 58, 237, 0.16);
    --file-item-bg: #f1f5f9;
    --file-item-hover-shadow: rgba(14, 165, 233, 0.2);
    
    /* QR Code */
    --qr-bg: #ffffff;
    --qr-border: rgba(2, 132, 199, 0.3);
}

/* ============================================
   BODY BACKGROUNDS
   ============================================ */
body {
    background: radial-gradient(circle at 20% 20%, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 55%, #050509 100%);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */
.theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    font-size: 20px;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.theme-toggle:active {
    transform: translateY(0);
}

/* Position variant for pages with headers */
.theme-toggle--header {
    position: relative;
    top: auto;
    right: auto;
}

/* ============================================
   COMMON TRANSITIONS
   ============================================ */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ============================================
   COMMON PAGE LAYOUTS
   ============================================ */
.page-centered {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   CARD COMPONENTS
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.card--glass {
    background: var(--bg-glass);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

[data-theme="light"] .form-input:focus {
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

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

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #ffffff;
    border: none;
}

.btn--primary:hover {
    box-shadow: 0 12px 30px rgba(0, 212, 255, 0.3);
}

[data-theme="light"] .btn--primary:hover {
    box-shadow: 0 12px 30px rgba(2, 132, 199, 0.25);
}

.btn--danger {
    background: var(--accent-danger);
    color: #ffffff;
    border: none;
}

.btn--success {
    background: var(--accent-success);
    color: #ffffff;
    border: none;
}

.btn--pill {
    border-radius: 999px;
}

.btn--full {
    width: 100%;
}

/* ============================================
   ALERTS & MESSAGES
   ============================================ */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert--error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-danger);
}

.alert--success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-success);
}

.alert--warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent-warning);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: var(--table-header-bg);
    color: #ffffff;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tr:hover td {
    background: var(--table-hover-bg);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--badge-bg);
    color: var(--badge-color);
}

.badge--success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.badge--danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-bg);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 24px;
}

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

.modal,
.modal-content,
.modal-box {
    background: var(--modal-content-bg);
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-icon {
    font-size: 28px;
    flex-shrink: 0;
}

/* Optional: styled icon box variant */
.modal-icon--box {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

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

.modal-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-secondary {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.modal-btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.modal-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.modal-btn-danger {
    background: var(--gradient-danger);
    border: none;
    color: white;
}

.modal-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Modal button variants for confirm/cancel dialogs */
.modal-btn-confirm {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.modal-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 212, 255, 0.4);
}

.modal-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.modal-btn-cancel:hover {
    background: var(--bg-elevated);
    transform: translateY(-1px);
}

.modal-btn.hidden {
    display: none !important;
}

/* Modal input field */
.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-sans);
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

[data-theme="light"] .modal-input:focus {
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

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

/* ============================================
   PASSWORD VISIBILITY TOGGLE
   ============================================ */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    flex: 1;
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: var(--text-primary);
}

.password-toggle:focus {
    outline: none;
    color: var(--accent-primary);
}

/* ============================================
   TOAST NOTIFICATION SYSTEM
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, var(--bg-elevated) 100%);
}

.toast.success .toast-icon {
    color: var(--accent-success);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, var(--bg-elevated) 100%);
}

.toast.error .toast-icon {
    color: var(--accent-danger);
}

.toast.warning {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, var(--bg-elevated) 100%);
}

.toast.warning .toast-icon {
    color: var(--accent-warning);
}

.toast.info {
    border-color: rgba(0, 212, 255, 0.4);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, var(--bg-elevated) 100%);
}

.toast.info .toast-icon {
    color: var(--accent-primary);
}

/* ============================================
   CONNECTION STATUS INDICATOR
   ============================================ */
.connection-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    z-index: 99999;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.connection-banner.visible {
    transform: translateX(-50%) translateY(0);
}

.connection-banner.disconnected {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
    color: white;
}

.connection-banner.reconnecting {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
    color: white;
}

.connection-banner.connected {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    color: white;
}

.connection-banner-icon {
    font-size: 18px;
    animation: pulse 1.5s infinite;
}

.connection-banner.reconnecting .connection-banner-icon {
    animation: spin 1s linear infinite;
}

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

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

/* ============================================
   STORAGE QUOTA DISPLAY
   ============================================ */
.storage-quota {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.storage-quota-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.storage-quota-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.storage-quota-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.storage-quota-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.storage-quota-fill {
    height: 100%;
    width: 0;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.storage-quota-fill.warning {
    background: var(--gradient-danger);
}

/* ============================================
   SESSION EXPIRY MODAL
   ============================================ */
.session-expired-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.session-expired-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.session-expired-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s ease-out;
}

.session-expired-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.session-expired-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.session-expired-message {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.session-expired-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.session-expired-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ============================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ============================================ */
@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        width: 100%;
    }
    
    .connection-banner {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .storage-quota {
        padding: 14px 16px;
    }
    
    /* Ensure modals are mobile friendly */
    .modal,
    .modal-content,
    .modal-box {
        padding: 24px;
        margin: 16px;
        max-width: calc(100vw - 32px);
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
}

/* ============================================
   ADMIN TABLE MOBILE SCROLL
   ============================================ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Modal text/content area */
.modal-text {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Share Modal Specific Styles */
.modal-share {
    max-width: 520px;
}

.share-section {
    margin-bottom: 24px;
}

.share-section:last-child,
.share-section-last {
    margin-bottom: 0;
}

.share-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.shared-users-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-default);
    border-radius: 12px;
}

.shared-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.shared-user-row:last-child {
    border-bottom: none;
}

.shared-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shared-user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.shared-user-email {
    font-size: 12px;
    color: var(--text-muted);
}

.shared-user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.permission-badge {
    padding: 4px 10px;
    background: var(--accent-primary);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: black;
}

.remove-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--accent-danger);
    border-radius: 8px;
    color: var(--accent-danger);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.remove-btn:hover {
    background: var(--accent-danger);
    color: white;
}

.share-add-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.share-select {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
}

.share-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.share-checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

/* Empty state for modals */
.empty-state-padded {
    padding: 24px;
}

/* Modal Mobile Responsive */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 12px;
    }
    
    .modal,
    .modal-content {
        padding: 20px;
        border-radius: 16px;
    }
    
    .modal-header {
        margin-bottom: 16px;
    }
    
    .modal-icon {
        font-size: 24px;
    }
    
    .modal-icon--box {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-body {
        margin-bottom: 20px;
        font-size: 14px;
    }
    
    .modal-actions {
        gap: 8px;
    }
    
    .modal-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .share-add-form {
        flex-direction: column;
        gap: 10px;
    }
    
    .share-select {
        width: 100%;
    }
    
    .share-checkbox-label {
        align-self: flex-start;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-color: var(--accent-success);
}

.toast.error {
    border-color: var(--accent-danger);
}

.toast.warning {
    border-color: var(--accent-warning);
}

@media (max-width: 640px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    
    .toast {
        width: 100%;
    }
}

@supports (padding: max(0px)) {
    .toast-container {
        bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   HISTORY PANEL
   ============================================ */
.history-panel {
    position: fixed;
    right: 24px;
    bottom: 80px;
    width: 360px;
    max-height: 50vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 500;
}

.history-panel.visible {
    display: flex;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.history-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

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

.history-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
}

.history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.history-item:last-child {
    border-bottom: none;
}

.history-action {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

@media (max-width: 640px) {
    .history-panel {
        left: 12px;
        right: 12px;
        bottom: 60px;
        width: auto;
        max-height: 60vh;
    }
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */
.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    display: none;
    z-index: 500;
    max-height: 70vh;
    overflow-y: auto;
}

.dropdown.active {
    display: block;
}

.dropdown-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.dropdown-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Dropdown overlay for mobile */
.dropdown-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.dropdown-overlay.active {
    display: block;
}

@media (max-width: 640px) {
    .dropdown {
        position: fixed !important;
        top: unset !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        padding-top: 16px;
        padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
        max-height: 80vh;
        overflow-y: auto;
        z-index: 10000;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
        border-bottom: none;
        transform: none !important;
    }
    
    /* Drag handle indicator */
    .dropdown::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-strong);
        border-radius: 2px;
        margin: 0 auto 16px auto;
    }
    
    .dropdown-header {
        padding: 16px;
        margin-bottom: 12px;
        background: var(--bg-tertiary);
        border-radius: 12px;
        border-bottom: none;
    }
    
    .dropdown-name {
        font-size: 18px !important;
        font-weight: 700 !important;
    }
    
    .dropdown-item {
        padding: 18px 16px !important;
        font-size: 17px !important;
        border-radius: 12px;
        margin-bottom: 8px;
        background: var(--bg-tertiary);
    }
    
    .dropdown-item.danger {
        background: rgba(239, 68, 68, 0.1);
    }
}

/* ============================================
   COLLABORATORS INDICATOR
   ============================================ */
.collaborators-indicator {
    display: none;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 12px;
    color: var(--accent-primary);
    border: 1px solid var(--border-subtle);
}

.collaborators-indicator.visible {
    display: flex;
}

/* ============================================
   STATUS INDICATORS
   ============================================ */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-success);
}

.status-dot.saving {
    background: var(--accent-warning);
    animation: pulse 1s infinite;
}

.status-dot.error {
    background: var(--accent-danger);
}

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

.typing-indicator {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.typing-indicator.visible {
    opacity: 1;
}

