/* ========================================
   VEIL - Zero-Knowledge Encrypted Vault
   CSS Styles
   ======================================== */

/* CSS Variables - Dark Theme (Default) */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --secondary: #64748b;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: #334155;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    
    --transition: all 0.2s ease;
    
    --header-height: 64px;
    --sidebar-width: 260px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #cbd5e1;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ========================================
   LOADING SCREEN
   ======================================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
}

.loading-logo i {
    font-size: 40px;
    color: white;
}

.loading-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ========================================
   Delete Overlay
   ======================================== */
.delete-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.delete-overlay__content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 28px 32px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    min-width: 280px;
    max-width: 340px;
}

.delete-overlay__spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.delete-overlay__spinner.success {
    border-color: rgba(34, 197, 94, 0.2);
    border-top-color: var(--success);
}

.delete-overlay__text {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Loading overlay for file/folder operations */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.loading-overlay__content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 28px 32px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    min-width: 280px;
    max-width: 340px;
}

.loading-overlay__spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay__text {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.loading-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

/* Small inline spinner for buttons */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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

/* ========================================
   AUTH SCREEN
   ======================================== */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    max-height: 95vh;
    overflow-y: auto;
    padding: 28px 32px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Custom scrollbar for auth container */
.auth-container::-webkit-scrollbar {
    width: 6px;
}

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

.auth-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.auth-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.auth-header {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
}

.auth-logo i {
    font-size: 28px;
    color: white;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.auth-form .form-group {
    margin-bottom: 12px;
}

/* Form row for side-by-side fields */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.form-group-half {
    flex: 1;
    margin-bottom: 0;
}

.form-group-half > label,
.form-group-half > .label-with-status {
    height: 20px;
    display: flex;
    align-items: center;
}

/* Label with inline status */
.label-with-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.label-with-status label {
    margin-bottom: 0;
    height: auto;
}

.label-with-status .field-status {
    margin-top: 0;
    min-height: auto;
    font-size: 0.65rem;
    text-align: right;
}

/* Smaller status for confirm password (less space available) */
#confirm-status {
    font-size: 0.55rem;
    white-space: nowrap;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.auth-form input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.auth-form input::placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.password-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    font-size: 0.8rem;
}

.auth-message {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    font-size: 0.8rem;
}

.auth-buttons {
    display: flex;
    gap: 12px;
}

.auth-buttons .btn {
    flex: 1;
}

.auth-footer {
    margin-top: 16px;
    text-align: center;
}

.auth-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auth-footer i {
    color: var(--success);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--primary);
    color: white;
}

/* Auth Forms */
.btn-full {
    width: 100%;
}

/* Login button extra spacing */
.login-btn-spacing {
    margin-top: 12px;
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.password-toggle i {
    font-size: 18px;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 4px;
}

.strength-bar {
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 2px;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-fill.weak { background: var(--danger); width: 25%; }
.strength-fill.fair { background: var(--warning); width: 50%; }
.strength-fill.good { background: #22d3ee; width: 75%; }
.strength-fill.strong { background: var(--success); width: 100%; }

.strength-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.strength-text.weak { color: var(--danger); }
.strength-text.fair { color: var(--warning); }
.strength-text.good { color: #22d3ee; }
.strength-text.strong { color: var(--success); }

/* Password Requirements - collapsible */
.password-requirements {
    margin-top: 6px;
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
}

.password-requirements.visible {
    max-height: 50px;
    opacity: 1;
    margin-bottom: 14px;
}

.requirement {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 2px;
}

.requirement i {
    font-size: 10px;
}

.requirement.met {
    color: var(--success);
}

.requirement.met i::before {
    content: "\eb7a"; /* bx-check icon */
}

/* Field Status */
.field-status {
    display: block;
    font-size: 0.7rem;
    margin-top: 4px;
    min-height: 16px;
}

.field-status.checking {
    color: var(--text-muted);
}

.field-status.available {
    color: var(--success);
}

.field-status.taken {
    color: var(--danger);
}

.field-status.error {
    color: var(--danger);
}

.field-status.match {
    color: var(--success);
}

/* Create Account Link in Error */
.auth-error a {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.auth-error a:hover {
    color: var(--primary-hover);
}

/* Password Warning Modal */
#password-warning-modal {
    z-index: 9999;
}

.password-warning-content {
    max-width: 480px;
    padding: 32px;
    text-align: center;
}

.warning-icon {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.warning-icon i {
    font-size: 32px;
    color: var(--danger);
}

.warning-text {
    text-align: left;
    margin-bottom: 24px;
}

.warning-text p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.warning-text ul {
    list-style: none;
    margin: 16px 0;
}

.warning-text li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.warning-text li i {
    font-size: 18px;
    color: var(--primary);
}

.warning-highlight {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--border-radius);
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--danger) !important;
    font-weight: 500;
}

.warning-highlight i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

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

.btn-secondary:hover {
    background: var(--bg-hover);
}

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-action {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

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

.icon-btn i {
    font-size: 20px;
}

.icon-btn-small {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

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

.icon-btn-small i {
    font-size: 16px;
}

/* ========================================
   APP LAYOUT
   ======================================== */
.app-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    position: relative;
    z-index: 1001; /* Above sidebar */
}

.header-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-username {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-username:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.header-username i {
    font-size: 1.2rem;
    color: var(--primary);
}

.header-center {
    flex: 0 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo i {
    font-size: 28px;
    color: var(--primary);
}

.header-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* Search Container - Expandable */
.search-container {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: 20px;
    width: 40px;
    height: 40px;
    overflow: hidden;
    transition: width 0.3s ease;
    cursor: pointer;
}

.search-container.expanded {
    width: 250px;
    cursor: default;
}

.search-container .search-icon {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
}

.search-container:hover .search-icon {
    color: var(--text-primary);
}

.search-container input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0 12px 0 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.search-container.expanded input {
    width: auto;
    opacity: 1;
}

.search-container input:focus {
    outline: none;
}

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

/* Main Content */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.3s ease, margin-left 0.3s ease;
    margin-left: 48px;
    position: relative;
    z-index: 100; /* Below header (1001) */
}

.sidebar.collapsed {
    width: 0;
    padding: 0;
    overflow: hidden;
    border-right: none;
}

.sidebar.collapsed .sidebar-section {
    opacity: 0;
    pointer-events: none;
}

/* Sidebar Toggle Button - hidden on desktop, shown in separate bar on mobile */
.header-left .sidebar-toggle-btn {
    display: none; /* Hidden on both - use strip instead */
}

/* Desktop Sidebar Toggle Strip */
.desktop-sidebar-strip {
    position: fixed;
    left: 0;
    top: var(--header-height); /* Below header */
    width: 48px;
    height: calc(100% - var(--header-height));
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
}

.sidebar-toggle-strip-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.sidebar-toggle-strip-btn:hover {
    background: var(--bg-tertiary);
}

/* Hamburger Icon */
.hamburger-icon {
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    position: relative;
    transition: background 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    transition: transform 0.3s ease, top 0.3s ease;
}

.hamburger-icon::before {
    top: -6px;
}

.hamburger-icon::after {
    top: 6px;
}

/* Hamburger to X animation when sidebar is open */
.sidebar-toggle-btn.active .hamburger-icon,
.sidebar-toggle-strip-btn.active .hamburger-icon {
    background: transparent;
}

.sidebar-toggle-btn.active .hamburger-icon::before,
.sidebar-toggle-strip-btn.active .hamburger-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.sidebar-toggle-btn.active .hamburger-icon::after,
.sidebar-toggle-strip-btn.active .hamburger-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-top: auto;
}

.sidebar-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.section-header h3 {
    margin-bottom: 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sidebar-menu li:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-menu li.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-menu li i {
    font-size: 18px;
}

/* Folder List */
.folder-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-size: 0.85rem;
    user-select: none;
}

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

.folder-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.folder-item i {
    font-size: 16px;
}

.folder-item .folder-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.folder-item .folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.folder-item .folder-actions {
    display: none;
}

.folder-item:hover .folder-actions {
    display: flex;
}

.folder-item .folder-actions .icon-btn-small {
    width: 24px;
    height: 24px;
}

/* Storage Info */
.storage-info {
    padding: 16px 20px;
}

.storage-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.storage-used {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.storage-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========================================
   CONTENT AREA
   ======================================== */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

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

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.breadcrumb-item:hover {
    color: var(--text-primary);
}

.breadcrumb-item.current {
    color: var(--text-primary);
    cursor: default;
}

.breadcrumb-separator {
    color: var(--text-muted);
}

.content-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Date Filter */
.date-filter {
    position: relative;
}

.date-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-filter-btn .bx-chevron-down {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.date-filter-btn.active .bx-chevron-down {
    transform: rotate(180deg);
}

.date-filter-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 12px;
    display: none;
}

.date-filter-dropdown.show {
    display: block;
}

.date-filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.date-preset {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.date-preset:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.date-preset.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.date-custom-range {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    display: none;
}

.date-custom-range.show {
    display: block;
}

.date-input-group {
    margin-bottom: 12px;
}

.date-input-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.date-input-group input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    color-scheme: dark;
}

.date-input-group input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.date-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.date-filter-type {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.date-filter-type label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.date-filter-type select {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.date-filter-type select:focus {
    outline: none;
    border-color: var(--primary);
}

.date-filter-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
}

.date-filter-actions .btn {
    flex: 1;
}

/* Selection Bar */
.selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
}

.selection-actions {
    display: flex;
    gap: 8px;
}

.selection-bar .btn-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.selection-bar .btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
}

.selection-bar .btn-danger {
    background: var(--danger);
}

/* ========================================
   FILE CONTAINER
   ======================================== */
.file-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Grid View */
.file-container.grid-view {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-content: start;
}

/* List View */
.file-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* File Card (Grid) */
.file-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border: 2px solid transparent;
    width: 160px;
    flex-shrink: 0;
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Selection overlay on thumbnail */
.file-card .card-thumbnail .selection-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.file-card .card-thumbnail .selection-overlay i {
    width: 60px;
    height: 60px;
    background: rgba(50, 50, 50, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--primary);
    border: 3px solid var(--primary);
}

.file-card.selected .card-thumbnail .selection-overlay {
    opacity: 1;
}

.file-card .card-thumbnail {
    width: 100%;
    height: 120px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.file-card .card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

.file-card .card-thumbnail .file-icon {
    font-size: 48px;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.file-card .card-thumbnail .folder-icon-large {
    font-size: 64px;
}

.file-card .card-thumbnail .video-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: white;
}

.file-card .card-thumbnail .loading-thumb {
    width: 32px;
    height: 32px;
    border: 2px solid var(--bg-hover);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.file-card .card-info {
    padding: 12px;
}

.file-card .card-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-card .card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-card .card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.file-card:hover .card-actions {
    opacity: 1;
}

.file-card .card-select {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    cursor: pointer;
}

.file-card:hover .card-select,
.file-card.selected .card-select {
    opacity: 1;
}

.file-card.selected .card-select {
    background: var(--primary);
    border-color: var(--primary);
}

.file-card.selected .card-select i {
    color: white;
    font-size: 14px;
}

/* Folder Card */
.file-card.folder-card .card-thumbnail {
    background: transparent;
}

.file-card.folder-card .folder-visual {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-card.folder-card .folder-visual i {
    font-size: 80px;
}

/* File Row (List) */
.file-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.file-row:hover {
    background: var(--bg-tertiary);
}

.file-row.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-row .row-select {
    width: 20px;
    height: 20px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.file-row.selected .row-select {
    background: var(--primary);
    border-color: var(--primary);
}

.file-row.selected .row-select i {
    color: white;
    font-size: 12px;
}

.file-row .row-thumbnail {
    width: 48px;
    height: 48px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.file-row .row-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-row .row-thumbnail i {
    font-size: 24px;
    color: var(--text-muted);
}

.file-row .row-info {
    flex: 1;
    min-width: 0;
}

.file-row .row-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-row .row-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-row .row-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.file-row:hover .row-actions {
    opacity: 1;
}

/* Drag indicator styles */
.file-card.drag-over,
.file-row.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-card[draggable="true"],
.file-row[draggable="true"] {
    cursor: grab;
}

.file-card[draggable="true"]:active,
.file-row[draggable="true"]:active {
    cursor: grabbing;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

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

.empty-state h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.9rem;
}

/* ========================================
   DROP ZONE
   ======================================== */
.drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.1);
    border: 3px dashed var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.drop-zone-content {
    text-align: center;
}

.drop-zone-content i {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 16px;
}

.drop-zone-content h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.drop-zone-content p {
    color: var(--text-secondary);
}

/* ========================================
   MODALS
   ======================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    max-width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-close i {
    font-size: 20px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(85vh - 80px);
}

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

/* Upload Modal */
.upload-modal-content {
    width: 500px;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 48px 24px;
    text-align: center;
    transition: var(--transition);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-dropzone i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-dropzone p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-dropzone span {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.upload-destination {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.upload-destination span {
    color: var(--text-primary);
    font-weight: 500;
}

.upload-queue {
    margin-top: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.upload-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.upload-queue h3 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-counter {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    background: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    display: none;
    min-width: 45px;
    text-align: center;
}

.upload-counter.show {
    display: inline-block;
}

.upload-current-file {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.upload-current-file.show {
    display: flex;
}

.current-file-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.current-file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.upload-list {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.upload-list::-webkit-scrollbar {
    width: 6px;
}

.upload-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.upload-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.upload-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.upload-item:last-child {
    margin-bottom: 0;
}

.upload-item:hover {
    border-color: var(--primary-light);
}

.upload-item .upload-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-hover);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-item .upload-icon i {
    font-size: 20px;
    color: var(--text-muted);
}

.upload-item .upload-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.upload-item .upload-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-item .upload-progress-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.upload-item .upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark, #4f46e5));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.upload-item .upload-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.upload-item .upload-status.success {
    color: var(--success);
}

.upload-item .upload-status.error {
    color: var(--danger);
}

/* Upload Progress Circle */
.upload-item .upload-progress-circle {
    width: 48px;
    height: 48px;
    position: relative;
    flex-shrink: 0;
}

.upload-item .upload-progress-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.upload-item .upload-progress-circle .progress-bg {
    fill: none;
    stroke: var(--bg-hover);
    stroke-width: 4;
}

.upload-item .upload-progress-circle .progress-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 100.53;
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.3s ease;
}

.upload-item .upload-progress-circle .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Upload Cancel Button */
.upload-cancel-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-left: auto;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.upload-cancel-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.05);
}

/* Preview Modal */
.preview-modal-content {
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Preview Navigation Arrows */
.preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
    opacity: 0.7;
}

.preview-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

.preview-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.preview-nav-prev {
    left: 0;
    border-radius: 0 8px 8px 0;
}

.preview-nav-next {
    right: 0;
    border-radius: 8px 0 0 8px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.preview-header h2 {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: var(--bg-primary);
    position: relative;
}

.preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-body video {
    max-width: 100%;
    max-height: 100%;
}

.preview-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.preview-body .text-preview {
    width: 100%;
    height: 100%;
    padding: 24px;
    background: var(--bg-secondary);
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    overflow: auto;
}

.preview-body .unsupported-preview {
    text-align: center;
    color: var(--text-secondary);
}

.preview-body .unsupported-preview i {
    font-size: 64px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.progress-circle .progress-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 8;
}

.progress-circle .progress-bar {
    fill: none;
    stroke: var(--primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-text span {
    display: block;
}

.progress-text #preview-progress-percent {
    font-size: 1.25rem;
    font-weight: 600;
}

.progress-text #preview-progress-eta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

#preview-status {
    margin-top: 16px;
    color: var(--text-secondary);
}

/* Folder Modal */
.folder-modal-content {
    width: 400px;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary);
}

.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-option {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

.icon-option:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.icon-option i {
    font-size: 18px;
}

/* Move Modal */
.move-modal-content {
    width: 400px;
}

.move-folder-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.move-folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
}

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

.move-folder-item.selected {
    background: var(--primary-light);
    color: var(--primary);
}

.move-folder-item i {
    font-size: 18px;
}

/* Delete Progress Modal */
.delete-modal-content {
    width: 400px;
    text-align: center;
}

.delete-progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 24px;
}

.delete-progress-circle {
    width: 120px;
    height: 120px;
    position: relative;
}

.delete-progress-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.delete-progress-circle .progress-bg {
    fill: none;
    stroke: var(--bg-hover);
    stroke-width: 4;
}

.delete-progress-circle .progress-fill {
    fill: none;
    stroke: var(--danger);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 100.53;
    stroke-dashoffset: 100.53;
    transition: stroke-dashoffset 0.3s ease;
}

.delete-progress-circle .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
}

.delete-progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.delete-progress-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.delete-progress-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.delete-current-item {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hide dropzone during upload */
.upload-dropzone.hidden {
    display: none;
}

/* Settings Modal */
.settings-modal-content {
    width: 450px;
    max-height: 85vh;
}

.settings-modal-content .modal-body {
    max-height: calc(85vh - 80px);
    overflow-y: auto;
    padding-bottom: 30px;
}

/* Profile Modal */
.profile-modal-content {
    width: 400px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar i {
    font-size: 40px;
    color: white;
}

.profile-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
}

.profile-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.profile-item span {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

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

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

.settings-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.user-email {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* Settings Field */
.settings-field {
    margin-bottom: 16px;
}

.settings-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Username Display */
.username-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    min-height: 42px;
}

.username-display.hidden {
    display: none;
}

.username-display #username-text {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.username-display #username-text.not-set {
    color: var(--text-secondary);
    font-style: italic;
}

.edit-username-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius);
    transition: opacity 0.2s, color 0.2s, background 0.2s;
}

.username-display:hover .edit-username-btn {
    opacity: 1;
}

.edit-username-btn:hover {
    color: var(--primary);
    background: var(--bg-secondary);
}

.settings-input-row {
    display: flex;
    gap: 8px;
}

.settings-input-row.hidden {
    display: none;
}

.settings-input-row input {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.settings-input-row input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.8rem;
}

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

.btn-secondary:hover {
    background: var(--bg-secondary);
}

/* Theme Options */
.theme-options {
    display: flex;
    gap: 8px;
}

.theme-option {
    flex: 1;
    cursor: pointer;
}

.theme-option input {
    display: none;
}

.theme-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    transition: var(--transition);
}

.theme-label i {
    font-size: 16px;
}

.theme-option input:checked + .theme-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.theme-option:hover .theme-label {
    border-color: var(--text-muted);
}

/* Large File Modal */
.large-file-modal-content {
    width: 400px;
}

.large-file-tip {
    margin-top: 16px;
    padding: 12px;
    background: var(--primary-light);
    border-radius: var(--border-radius);
    color: var(--primary);
    font-weight: 500;
}

/* ========================================
   CONTEXT MENU
   ======================================== */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    min-width: 180px;
    z-index: 2000;
    overflow: hidden;
}

.context-menu ul {
    list-style: none;
}

.context-menu li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.context-menu li:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.context-menu li.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.context-menu li i {
    font-size: 16px;
}

.context-menu .divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
    padding: 0;
}

.context-menu .divider:hover {
    background: var(--border-color);
    cursor: default;
}

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

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

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

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

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

.toast i {
    font-size: 20px;
}

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

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

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

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   CUSTOM DIALOG SYSTEM
   ======================================== */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
    animation: dialogFadeIn 0.2s ease;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.custom-dialog {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideIn 0.25s ease;
    border: 1px solid var(--border-color);
}

@keyframes dialogSlideIn {
    from {
        transform: scale(0.95) translateY(-10px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.custom-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 16px;
}

.custom-dialog-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.custom-dialog-icon.info {
    background: var(--primary-light);
    color: var(--primary);
}

.custom-dialog-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.custom-dialog-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.custom-dialog-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.custom-dialog-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.custom-dialog-body {
    padding: 0 24px 20px;
}

.custom-dialog-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-line;
}

.custom-dialog-input {
    width: 100%;
    padding: 12px 14px;
    margin-top: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.custom-dialog-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.custom-dialog-input.error {
    border-color: var(--danger);
}

.custom-dialog-input-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.custom-dialog-input-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 8px;
}

/* Password input wrapper with toggle button */
.custom-dialog-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 16px;
}

.custom-dialog-input-wrapper .custom-dialog-input {
    margin-top: 0;
    padding-right: 48px;
}

.custom-dialog-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.custom-dialog-toggle-password i {
    font-size: 1.25rem;
}

.custom-dialog-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
}

.custom-dialog-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.custom-dialog-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.custom-dialog-btn-cancel:hover {
    background: var(--bg-hover);
}

.custom-dialog-btn-confirm {
    background: var(--primary);
    color: white;
}

.custom-dialog-btn-confirm:hover {
    background: var(--primary-dark);
}

.custom-dialog-btn-danger {
    background: var(--danger);
    color: white;
}

.custom-dialog-btn-danger:hover {
    background: #dc2626;
}

.custom-dialog-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .custom-dialog {
        max-width: 95%;
        margin: 0 10px;
    }
    
    .custom-dialog-header {
        padding: 16px 20px 12px;
    }
    
    .custom-dialog-body {
        padding: 0 20px 16px;
    }
    
    .custom-dialog-actions {
        padding: 12px 20px 16px;
    }
}

/* ========================================
   TWO-FACTOR AUTHENTICATION STYLES
   ======================================== */

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border-radius: 26px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: #fff;
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 2FA Settings Section */
.settings-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.twofa-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.twofa-method {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    transition: all 0.2s ease;
}

.twofa-method:hover {
    border-color: var(--primary-muted);
}

.twofa-method.enabled {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.twofa-method-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.twofa-method-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.twofa-method-info > i {
    font-size: 1.5rem;
    color: var(--primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 92, 246, 0.1);
    border-radius: var(--border-radius);
}

.twofa-method-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.twofa-method-info p {
    margin: 2px 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 2FA Backup Section */
.twofa-backup-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 16px;
}

.twofa-backup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* 2FA Setup Modal */
.twofa-setup-modal-content {
    max-width: 520px;
    width: 95%;
}

.twofa-setup-modal-content .modal-body {
    max-height: calc(85vh - 100px);
    padding-bottom: 30px;
}

.twofa-setup-step {
    animation: fadeIn 0.3s ease;
}

.twofa-setup-step h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.twofa-setup-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Method Cards */
.twofa-method-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.twofa-method-card {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.twofa-method-card:hover {
    border-color: var(--primary-muted);
}

.twofa-method-card input {
    position: absolute;
    opacity: 0;
}

.twofa-method-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.08);
}

.twofa-card-content {
    flex: 1;
}

.twofa-card-content i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.twofa-card-content h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.twofa-card-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.twofa-card-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.twofa-card-check i {
    font-size: 1rem;
    color: transparent;
}

.twofa-method-card:has(input:checked) .twofa-card-check {
    background: var(--primary);
    border-color: var(--primary);
}

.twofa-method-card:has(input:checked) .twofa-card-check i {
    color: #fff;
}

/* Setup Error */
.twofa-setup-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--border-radius);
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.twofa-setup-error i {
    font-size: 1.1rem;
}

/* Setup Actions */
.twofa-setup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* QR Code Container */
.twofa-qr-container {
    text-align: center;
    margin-bottom: 24px;
}

.twofa-qr-code {
    background: #fff;
    padding: 16px;
    border-radius: var(--border-radius-lg);
    display: inline-block;
    margin-bottom: 16px;
}

.twofa-qr-code canvas {
    display: block;
}

.twofa-secret-manual {
    text-align: center;
}

.twofa-secret-manual p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.twofa-secret-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 10px 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.twofa-secret-display code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--primary);
    letter-spacing: 2px;
}

/* OTP Input Group */
.otp-input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 20px 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.otp-input:focus {
    border-color: var(--primary);
    outline: none;
    background: var(--bg-secondary);
}

.otp-input.error {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

.otp-input.success {
    border-color: var(--success);
}

/* Verify Input Section */
.twofa-verify-input {
    margin-top: 24px;
}

.twofa-verify-input label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-align: center;
}

/* Backup Codes */
.backup-codes-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.backup-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 10px 14px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--border-color);
}

.backup-code.used {
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.5;
}

.backup-codes-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.backup-codes-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.backup-codes-warning i {
    font-size: 1.25rem;
    color: #f59e0b;
    flex-shrink: 0;
    margin-top: 2px;
}

.backup-codes-warning p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.backup-codes-confirm {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.backup-codes-confirm:hover {
    border-color: var(--primary-muted);
}

.backup-codes-confirm input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.backup-codes-confirm span {
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* 2FA Verification Modal (Login) */
.twofa-verify-modal-content {
    max-width: 440px;
}

.twofa-verify-description {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
}

.twofa-verify-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: var(--border-radius-lg);
}

.twofa-verify-tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.twofa-verify-tab:hover {
    color: var(--text-primary);
}

.twofa-verify-tab.active {
    background: var(--bg-secondary);
    color: var(--primary);
    font-weight: 500;
}

.twofa-verify-tab.hidden {
    display: none;
}

.twofa-verify-section {
    animation: fadeIn 0.2s ease;
}

/* Email OTP Waiting State */
.email-otp-waiting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
}

.email-otp-waiting .btn-primary {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.verify-method-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.verify-method-description strong {
    color: var(--text-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 auto;
    transition: opacity 0.2s ease;
}

.btn-link:hover {
    opacity: 0.8;
}

.btn-link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Backup Code Input */
.backup-code-input {
    width: 100%;
    max-width: 200px;
    margin: 16px auto;
    display: block;
    text-align: center;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.2rem;
    letter-spacing: 2px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    text-transform: uppercase;
}

.backup-code-input:focus {
    border-color: var(--primary);
    outline: none;
}

.backup-code-warning {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Verify Error */
.twofa-verify-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--border-radius);
    color: var(--error);
    font-size: 0.875rem;
    margin: 16px 0;
}

/* Verify Actions */
.twofa-verify-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.twofa-verify-actions .btn {
    flex: 1;
}

/* Backup Codes Modal */
.backup-codes-modal-content {
    max-width: 460px;
}

.backup-codes-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

.backup-codes-view-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.backup-codes-stats {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.backup-codes-actions-modal {
    display: flex;
    justify-content: center;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Biometric Verification Styles */
.biometric-verify-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
}

.biometric-icon-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: biometricPulse 2s ease-in-out infinite;
}

.biometric-icon-large i {
    font-size: 2.5rem;
    color: #fff;
}

.btn-biometric {
    padding: 14px 28px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-biometric i {
    font-size: 1.25rem;
}

.biometric-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 8px;
}

/* Biometric unavailable state in setup card */
.twofa-card-unavailable {
    position: absolute;
    bottom: 10px;
    left: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    color: var(--error);
}

.twofa-card-unavailable i {
    font-size: 0.9rem;
}

.twofa-method-card.unavailable {
    opacity: 0.6;
    pointer-events: none;
}

.twofa-method-card.unavailable .twofa-card-content i {
    color: var(--text-muted);
}

/* Biometric pulse animation */
@keyframes biometricPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(139, 92, 246, 0);
        transform: scale(1.05);
    }
}

/* Biometric verifying state */
.biometric-verifying .biometric-icon-large {
    animation: biometricScan 0.8s ease-in-out infinite;
}

@keyframes biometricScan {
    0%, 100% {
        background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    }
    50% {
        background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    }
}

/* Responsive 2FA */
@media (max-width: 480px) {
    .otp-input {
        width: 40px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .otp-input-group {
        gap: 6px;
    }
    
    .twofa-verify-tabs {
        flex-direction: column;
    }
    
    .backup-codes-grid {
        grid-template-columns: 1fr;
    }
    
    .twofa-method-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .twofa-method-header .toggle-switch {
        align-self: flex-end;
    }
    
    .biometric-icon-large {
        width: 64px;
        height: 64px;
    }
    
    .biometric-icon-large i {
        font-size: 2rem;
    }
}

/* ========================================
   BIOMETRIC ADD DEVICE STYLES
   ======================================== */
.biometric-add-device {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px dashed var(--primary);
}

.biometric-new-device-msg {
    color: var(--warning);
    font-size: 0.9rem;
    margin-bottom: 12px;
    font-weight: 500;
}

#biometric-add-device-btn {
    min-height: 48px;
    padding: 12px 24px;
    font-size: 1rem;
    width: 100%;
    max-width: 280px;
}

/* ========================================
   MOBILE-ONLY ELEMENTS (hidden on desktop)
   ======================================== */
.mobile-only {
    display: none !important;
}

.mobile-menu-dropdown {
    display: none;
}

/* ========================================
   COMPREHENSIVE MOBILE OPTIMIZATION
   Under 768px width only
   ======================================== */
@media (max-width: 768px) {
    /* CSS Variables for mobile */
    :root {
        --header-height: 56px;
        --sidebar-width: 280px;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: flex !important;
    }
    
    /* Hide desktop header elements on mobile */
    .header-right .search-container,
    .header-right #view-toggle,
    .header-right #settings-btn,
    .header-right #logout-btn {
        display: none !important;
    }
    
    /* Mobile 3-dot menu button */
    #mobile-menu-btn {
        width: 44px;
        height: 44px;
    }
    
    #mobile-menu-btn i {
        font-size: 24px;
    }
    
    /* Mobile Menu Dropdown */
    .mobile-menu-dropdown {
        position: fixed;
        top: var(--header-height);
        right: 8px;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-lg);
        box-shadow: var(--shadow-lg);
        z-index: 2000;
        min-width: 180px;
        padding: 8px 0;
        display: none;
    }
    
    .mobile-menu-dropdown:not(.hidden) {
        display: block;
    }
    
    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 14px 20px;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 0.95rem;
        cursor: pointer;
        text-align: left;
        min-height: 48px;
    }
    
    .mobile-menu-item:active {
        background: var(--bg-tertiary);
    }
    
    .mobile-menu-item i {
        font-size: 20px;
        color: var(--text-secondary);
    }
    
    .mobile-menu-divider {
        height: 1px;
        background: var(--border-color);
        margin: 8px 0;
    }
    
    .mobile-menu-danger {
        color: var(--danger);
    }
    
    .mobile-menu-danger i {
        color: var(--danger);
    }
    
    /* Mobile Search Overlay */
    .mobile-search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        padding: 12px 16px;
        z-index: 2001;
        display: flex;
        align-items: center;
        gap: 12px;
        box-shadow: var(--shadow-md);
    }
    
    .mobile-search-overlay input {
        flex: 1;
        height: 44px;
        font-size: 16px;
    }
    
    .mobile-search-overlay .close-search-btn {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 24px;
        cursor: pointer;
    }
    
    /* Typography - scalable fonts */
    html {
        font-size: clamp(14px, 3.5vw, 16px);
    }
    
    h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
    h2 { font-size: clamp(1.25rem, 4vw, 1.5rem); }
    h3 { font-size: clamp(1.1rem, 3.5vw, 1.25rem); }
    
    /* ---- NAVIGATION: Slide-in Drawer ---- */
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        height: calc(100% - var(--header-height));
        width: var(--sidebar-width);
        max-width: 85vw;
        z-index: 999; /* Below header (1001) */
        margin-left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
        padding-top: 0;
    }
    
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    
    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: var(--header-height);
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Show desktop sidebar strip on mobile too - positioned below header */
    .desktop-sidebar-strip {
        display: flex !important;
        position: fixed;
        left: 0;
        top: var(--header-height);
        width: 100%;
        height: 48px;
        flex-direction: row;
        padding: 0 12px;
        justify-content: flex-start;
        z-index: 997;
    }
    
    /* Keep sidebar toggle hidden in header */
    .header-left .sidebar-toggle-btn {
        display: none;
    }
    
    /* Content area starts below toggle strip */
    .content-area {
        margin-top: 48px;
    }
    
    /* Sidebar starts below toggle strip */
    .sidebar {
        top: calc(var(--header-height) + 48px);
        height: calc(100% - var(--header-height) - 48px);
    }
    
    .sidebar-overlay {
        top: calc(var(--header-height) + 48px);
    }
    
    /* Header mobile adjustments */
    .app-header {
        padding: 0 12px;
        height: var(--header-height);
    }
    
    .header-left {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }
    
    .header-left h2,
    .header-username span {
        font-size: 0.9rem;
        max-width: 100px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Show center logo on mobile */
    .header-center {
        display: flex;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .header-center .logo {
        font-size: 1rem;
    }
    
    .header-center .logo i {
        font-size: 1.2rem;
    }
    
    .header-right {
        gap: 4px;
    }
    
    .header-right .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    /* ---- GALLERY: 2-Column Grid ---- */
    .file-container.grid-view {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
        align-content: start;
    }
    
    .file-card {
        width: 100%;
        max-width: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        position: relative;
    }
    
    /* Thumbnail - square aspect ratio for mobile */
    .file-card .card-thumbnail {
        width: 100%;
        height: 0;
        padding-bottom: 100%; /* Square aspect ratio */
        overflow: hidden;
        position: relative;
    }
    
    .file-card .card-thumbnail img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .file-card .card-thumbnail .file-icon,
    .file-card .card-thumbnail .loading-thumb {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    
    /* Re-enable pointer events for action buttons only */
    .file-card .card-actions {
        pointer-events: auto;
        opacity: 1;
        z-index: 5;
    }
    
    .file-card .card-select {
        pointer-events: auto;
        z-index: 5;
    }
    
    /* Consistent video indicator */
    .file-card .card-thumbnail .video-indicator {
        position: absolute;
        bottom: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        background: rgba(0, 0, 0, 0.75);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .file-card .card-thumbnail .video-indicator i {
        font-size: 16px;
        color: white;
        margin-left: 2px;
    }
    
    .file-card .card-info {
        padding: 10px;
        pointer-events: none;
    }
    
    .file-card .card-name {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    /* Folder cards in grid */
    .folder-card {
        width: 100%;
    }
    
    /* ---- MODALS: Fullscreen on Mobile ---- */
    .modal-content,
    .upload-modal-content,
    .folder-modal-content,
    .move-modal-content,
    .settings-modal-content,
    .large-file-modal-content,
    .preview-modal-content,
    .twofa-setup-modal-content,
    .twofa-verify-modal-content,
    .backup-codes-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
    }
    
    /* Modal headers - close button reachable */
    .modal-header {
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        z-index: 10;
        padding: 16px;
        border-bottom: 1px solid var(--border-color);
    }
    
    .modal-header .close-btn,
    .close-preview-btn,
    .modal-close-btn,
    .modal-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .modal-close i {
        font-size: 24px;
    }
    
    /* Modal body scrollable */
    .modal-body,
    .settings-content,
    .twofa-setup-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        padding-bottom: 100px; /* Space for bottom actions */
    }
    
    /* Modal actions at bottom */
    .modal-actions,
    .twofa-setup-actions,
    .twofa-verify-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        z-index: 10;
        display: flex;
        gap: 12px;
    }
    
    .modal-actions .btn,
    .twofa-setup-actions .btn,
    .twofa-verify-actions .btn {
        flex: 1;
    }
    
    /* ---- BUTTONS: 44px Min Touch Targets ---- */
    .btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 10px 14px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    .btn-action {
        min-height: 44px;
        padding: 10px 16px;
    }
    
    /* Form inputs touch-friendly */
    input, select, textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
    }
    
    /* Toggle switches */
    .toggle-switch {
        transform: scale(1.1);
    }
    
    /* ---- CONTENT HEADER ---- */
    .content-header {
        padding: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .breadcrumb {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }
    
    .content-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
    
    /* ---- UPLOAD AREA ---- */
    .upload-dropzone {
        padding: 24px 16px;
    }
    
    .upload-dropzone i {
        font-size: 2.5rem;
    }
    
    .upload-dropzone h3 {
        font-size: 1.1rem;
    }
    
    /* Upload queue mobile */
    .upload-queue {
        max-height: 40vh;
    }
    
    .upload-item {
        padding: 12px;
    }
    
    /* ---- PREVIEW MODAL ---- */
    .preview-modal {
        padding: 0;
    }
    
    .preview-header {
        padding: 12px 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
    }
    
    .preview-content {
        padding-top: 60px;
        padding-bottom: 60px;
    }
    
    .preview-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        background: var(--bg-secondary);
    }
    
    /* ---- SETTINGS MODAL ---- */
    .settings-tabs {
        flex-direction: row;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }
    
    .settings-tab {
        flex: 1;
        min-width: max-content;
        padding: 12px 16px;
        justify-content: center;
        border-bottom: 2px solid transparent;
        border-right: none;
    }
    
    .settings-tab.active {
        border-bottom-color: var(--primary);
        border-right-color: transparent;
    }
    
    .settings-tab span {
        display: none;
    }
    
    .settings-tab i {
        font-size: 1.25rem;
    }
    
    .settings-panel {
        padding: 16px;
    }
    
    /* ---- 2FA VERIFICATION MOBILE ---- */
    .twofa-verify-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .twofa-verify-tab {
        flex: none;
        min-width: auto;
        padding: 12px 8px;
        font-size: 0.8rem;
        min-height: 44px;
    }
    
    .twofa-verify-tab i {
        font-size: 1.1rem;
    }
    
    .otp-input-group {
        gap: 8px;
    }
    
    .otp-input {
        width: 44px;
        height: 52px;
        font-size: 1.5rem;
    }
    
    /* Biometric section mobile */
    .biometric-verify-container {
        padding: 16px 0;
    }
    
    .biometric-icon-large {
        width: 70px;
        height: 70px;
    }
    
    .btn-biometric {
        width: 100%;
        max-width: 300px;
        min-height: 52px;
    }
    
    .biometric-add-device {
        margin-top: 16px;
        padding: 16px;
    }
    
    #biometric-add-device-btn {
        width: 100%;
        min-height: 52px;
    }
    
    .biometric-hint {
        font-size: 0.75rem;
        padding: 0 16px;
    }
    
    /* ---- AUTH SCREEN MOBILE ---- */
    .auth-container {
        padding: 20px;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
    }
    
    .auth-header {
        margin-bottom: 24px;
    }
    
    .auth-logo {
        width: 60px;
        height: 60px;
    }
    
    .auth-tabs {
        margin-bottom: 20px;
    }
    
    .auth-tab {
        padding: 12px 20px;
        min-height: 44px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .form-group-half {
        width: 100%;
    }
    
    /* ---- CONTEXT MENU MOBILE ---- */
    .context-menu {
        min-width: 200px;
        max-width: 90vw;
    }
    
    .context-item {
        padding: 14px 16px;
        min-height: 44px;
    }
    
    /* ---- TOAST NOTIFICATIONS ---- */
    .toast-container {
        bottom: 80px;
        left: 12px;
        right: 12px;
        max-width: none;
    }
    
    .toast {
        width: 100%;
    }
    
    /* ---- EMPTY STATE ---- */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-state i {
        font-size: 3rem;
    }
    
    .empty-state h3 {
        font-size: 1.2rem;
    }
    
    /* ---- LIST VIEW MOBILE ---- */
    .file-container.list-view .file-item {
        padding: 12px;
    }
    
    .file-item-info {
        min-width: 0;
        flex: 1;
    }
    
    .file-item-name {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .file-item-meta {
        font-size: 0.75rem;
    }
    
    /* ---- STORAGE BAR ---- */
    .storage-section {
        padding: 12px;
    }
    
    .storage-text {
        font-size: 0.8rem;
    }
    
    /* Disable hover effects on touch */
    @media (hover: none) {
        .file-card:hover {
            transform: none;
            box-shadow: none;
        }
        
        .btn:hover {
            transform: none;
        }
        
        .context-item:hover {
            background: transparent;
        }
    }
}

/* ========================================
   EXTRA SMALL SCREENS (< 480px)
   ======================================== */
@media (max-width: 480px) {
    /* Even smaller grid */
    .file-container.grid-view {
        gap: 6px;
        padding: 6px;
    }
    
    .file-card .card-thumbnail {
        aspect-ratio: 1;
    }
    
    .file-card .card-info {
        padding: 8px;
    }
    
    .file-card .card-name {
        font-size: 0.75rem;
    }
    
    /* OTP inputs smaller */
    .otp-input {
        width: 38px;
        height: 46px;
        font-size: 1.25rem;
    }
    
    /* Smaller header adjustments */
    .app-header {
        padding: 0 8px;
    }
    
    .header-username span {
        font-size: 0.9rem;
        max-width: 120px;
    }
    
    /* Auth adjustments */
    .auth-header h1 {
        font-size: 1.75rem;
    }
    
    /* Biometric */
    .biometric-icon-large {
        width: 60px;
        height: 60px;
    }
    
    .biometric-icon-large i {
        font-size: 1.75rem;
    }
}

/* ========================================
   PWA SAFE AREA HANDLING
   For notched phones and standalone mode
   ======================================== */

/* Modal and toast safe area padding - applies to all modes */
@supports (padding: env(safe-area-inset-bottom)) {
    .modal-actions,
    .twofa-verify-actions,
    .preview-actions {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    
    .toast-container {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* ========================================
   PWA STANDALONE MODE
   Installed app styles - SIMPLE APPROACH
   ======================================== */
@media (display-mode: standalone) {
    /* Prevent any bouncing */
    html, body {
        overscroll-behavior: none;
        overflow: hidden;
    }
    
    /* App screen uses safe viewport */
    .app-screen {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        /* Add safe area as padding */
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        box-sizing: border-box;
    }
    
    /* Header is flex-shrink 0 */
    .app-header {
        flex-shrink: 0;
    }
    
    /* Main takes remaining space */
    .app-main {
        flex: 1;
        min-height: 0;
        display: flex;
        overflow: hidden;
    }
    
    /* Content scrolls */
    .content-area {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Auth screen also fixed */
    .auth-screen {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
        overflow-y: auto;
    }
}

/* Mobile PWA adjustments */
@media (display-mode: standalone) and (max-width: 768px) {
    /* Desktop strip below header - adjust for safe area already applied to app-screen */
    .desktop-sidebar-strip {
        top: var(--header-height);
    }
    
    /* Sidebar below toggle strip */
    .sidebar {
        top: calc(var(--header-height) + 48px);
        height: calc(100% - var(--header-height) - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
    
    .sidebar-overlay {
        top: calc(var(--header-height) + 48px);
    }
}
