/* ═══════════════════════════════════════════
   Telegram Drive — Premium Dark Theme
   ═══════════════════════════════════════════ */

/* ═══════════ DESIGN TOKENS ═══════════ */
:root {
    /* Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2035;
    --bg-card: #151c2f;
    --bg-card-hover: #1c2541;
    --bg-glass: rgba(17, 24, 39, 0.8);
    
    --border-color: rgba(99, 110, 140, 0.15);
    --border-active: rgba(108, 92, 231, 0.4);
    
    --text-primary: #e8ecf4;
    --text-secondary: #8892a8;
    --text-muted: #5a6380;
    
    --accent-purple: #6c5ce7;
    --accent-purple-light: #a29bfe;
    --accent-blue: #0984e3;
    --accent-teal: #00b894;
    --accent-red: #d63031;
    --accent-orange: #e17055;
    --accent-yellow: #fdcb6e;
    
    --gradient-primary: linear-gradient(135deg, #6c5ce7 0%, #0984e3 100%);
    --gradient-glow: linear-gradient(135deg, rgba(108, 92, 231, 0.15) 0%, rgba(9, 132, 227, 0.15) 100%);
    --gradient-card: linear-gradient(135deg, rgba(108, 92, 231, 0.05) 0%, rgba(9, 132, 227, 0.05) 100%);
    
    /* Spacing */
    --sidebar-width: 280px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.15);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════ RESET & BASE ═══════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    outline: none;
}

input {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
    background: none;
    color: inherit;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 92, 231, 0.5);
}

/* ═══════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════ */

.auth-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 1000;
}

.auth-bg-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: floatShape 20s ease-in-out infinite;
}

.shape-1 {
    width: 400px; height: 400px;
    background: var(--accent-purple);
    top: -10%; left: -5%;
    animation-delay: 0s;
}

.shape-2 {
    width: 350px; height: 350px;
    background: var(--accent-blue);
    bottom: -10%; right: -5%;
    animation-delay: -7s;
}

.shape-3 {
    width: 300px; height: 300px;
    background: var(--accent-teal);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    opacity: 0.2;
}

@keyframes floatShape {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 15px) scale(1.03); }
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: authAppear 0.6s ease-out;
}

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

.auth-logo {
    text-align: center;
    margin-bottom: 36px;
}

.auth-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3); }
    50% { box-shadow: 0 8px 40px rgba(108, 92, 231, 0.5); }
}

.auth-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 46px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.input-wrapper input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: var(--accent-purple);
}

.input-wrapper:has(input:focus) .input-icon {
    color: var(--accent-purple);
}

.input-group input:not(.input-wrapper input) {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.input-group input:not(.input-wrapper input):focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

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

.auth-secondary-btn {
    align-self: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 4px 8px;
    transition: color var(--transition-fast);
}

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

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.auth-error {
    color: var(--accent-red);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
}

.auth-features {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 32px;
    flex-wrap: wrap;
}

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

.feature svg {
    color: var(--accent-purple-light);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════ */

.app-screen {
    display: flex;
    height: 100vh;
    overflow: hidden;
    animation: fadeInApp 0.5s ease;
}

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

/* ═══════════ SIDEBAR ═══════════ */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform var(--transition-slow);
    z-index: 100;
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo svg {
    color: var(--accent-purple);
}

.sidebar-toggle {
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.sidebar-nav {
    padding: 12px 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-align: left;
}

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

.nav-item.active {
    background: var(--gradient-glow);
    color: var(--accent-purple-light);
    border: 1px solid var(--border-active);
}

.sidebar-folders {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.btn-icon {
    padding: 4px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-icon.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-purple-light);
}

.folder-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
    text-align: left;
    background: none;
    border: none;
}

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

.folder-nav-item.active {
    background: var(--gradient-glow);
    color: var(--accent-purple-light);
}

.folder-nav-icon {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sidebar-stats {
    padding: 12px;
    display: flex;
    gap: 8px;
}

.stat-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.stat-icon {
    color: var(--accent-purple-light);
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-footer {
    padding: 8px 12px 16px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    color: var(--text-muted) !important;
}

.logout-btn:hover {
    color: var(--accent-red) !important;
    background: rgba(214, 48, 49, 0.1) !important;
}

/* ═══════════ MAIN CONTENT ═══════════ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Top Bar */
.top-bar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
    gap: 16px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    min-width: 0;
    overflow: hidden;
}

.breadcrumb-item {
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

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

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
    cursor: default;
}

.breadcrumb-item.active:hover {
    background: none;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.8rem;
    user-select: none;
}

/* Search */
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 200px;
    padding: 8px 12px 8px 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    width: 280px;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

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

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.mobile-only {
    display: none;
}

/* ═══════════ UPLOAD ZONE ═══════════ */

.upload-zone {
    margin: 16px 24px 0;
    padding: 28px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: all var(--transition-base);
    background: var(--gradient-card);
    flex-shrink: 0;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-purple);
    background: var(--gradient-glow);
    box-shadow: var(--shadow-glow);
}

.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-zone-content svg {
    color: var(--accent-purple-light);
    opacity: 0.6;
}

.upload-zone-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
}

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

/* ═══════════ UPLOAD PROGRESS ═══════════ */

.upload-progress {
    margin: 12px 24px 0;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.progress-header span:first-child {
    color: var(--text-secondary);
}

.progress-header span:last-child {
    color: var(--accent-purple-light);
    font-weight: 600;
}

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

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

.upload-queue {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    max-height: 60px;
    overflow-y: auto;
}

.upload-queue-item {
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
}

.upload-queue-item.done {
    color: var(--accent-teal);
}

/* ═══════════ FILE AREA ═══════════ */

.file-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px 24px;
}

/* Folders in content area */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.folder-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.folder-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.folder-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.folder-card-info {
    min-width: 0;
}

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

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

/* ═══════════ FILES GRID ═══════════ */

.files-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.files-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Grid File Card */
.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.file-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(108, 92, 231, 0.1);
}

.file-card-preview {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    position: relative;
    overflow: hidden;
}

.file-card-preview .file-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

.file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.file-card:hover .file-thumbnail {
    transform: scale(1.05);
}

.file-card-preview .file-type-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(108, 92, 231, 0.2);
    color: var(--accent-purple-light);
    backdrop-filter: blur(8px);
}

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

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

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

.file-card-encrypted {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 184, 148, 0.2);
    border-radius: 6px;
    backdrop-filter: blur(8px);
}

.file-card-encrypted svg {
    width: 12px;
    height: 12px;
    color: var(--accent-teal);
}

/* List View */
.list-view .file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
}

.list-view .file-card:hover {
    transform: none;
}

.list-view .file-card-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
}

.list-view .file-card-preview .file-icon {
    font-size: 1.2rem;
}

.list-view .file-card-preview .file-type-badge {
    display: none;
}

.list-view .file-card-info {
    flex: 1;
    padding: 0;
    display: flex;
    align-items: center;
    min-width: 0;
}

.list-view .file-card-name {
    flex: 1;
    margin: 0;
}

.list-view .file-card-meta {
    gap: 24px;
    flex-shrink: 0;
}

.list-view .file-card-encrypted {
    position: static;
    flex-shrink: 0;
}

/* ═══════════ EMPTY / LOADING STATES ═══════════ */

.empty-state, .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.loading-state p {
    color: var(--text-secondary);
    margin-top: 16px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ═══════════ MODALS ═══════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    animation: fadeIn 0.2s ease;
}

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

.modal {
    width: 90%;
    max-width: 440px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.25s ease;
}

.modal-sm {
    max-width: 380px;
}

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

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.modal-close {
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent !important;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.color-btn.active {
    border-color: white !important;
    box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 12px currentColor;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
}

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

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.3);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #e74c3c;
    box-shadow: 0 4px 16px rgba(214, 48, 49, 0.3);
}

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

.btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ═══════════ CONTEXT MENU ═══════════ */

.context-menu {
    position: fixed;
    z-index: 600;
    min-width: 180px;
    padding: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: contextAppear 0.15s ease;
}

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

.context-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-align: left;
}

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

.context-item.danger:hover {
    background: rgba(214, 48, 49, 0.1);
    color: var(--accent-red);
}

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

/* ═══════════ TOAST ═══════════ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 700;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    color: var(--text-primary);
    pointer-events: auto;
    animation: toastIn 0.3s ease;
    min-width: 200px;
    max-width: 400px;
}

.toast.toast-out {
    animation: toastOut 0.25s ease forwards;
}

.toast-success { border-left: 3px solid var(--accent-teal); }
.toast-error { border-left: 3px solid var(--accent-red); }
.toast-info { border-left: 3px solid var(--accent-blue); }
.toast-warning { border-left: 3px solid var(--accent-yellow); }

.toast-icon {
    flex-shrink: 0;
}

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

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

/* ═══════════ DRAG OVERLAY ═══════════ */

.drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(10, 14, 26, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.drag-overlay-content {
    text-align: center;
    animation: dragPulse 1.5s ease-in-out infinite;
}

.drag-overlay-content svg {
    color: var(--accent-purple-light);
    margin-bottom: 16px;
}

.drag-overlay-content h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.drag-overlay-content p {
    color: var(--text-secondary);
}

@keyframes dragPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* ═══════════ RESPONSIVE ═══════════ */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: var(--shadow-lg);
    }

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

    .mobile-only {
        display: flex;
    }

    .top-bar {
        padding: 0 16px;
    }

    .upload-zone {
        margin: 12px 16px 0;
        padding: 20px;
    }

    .file-area {
        padding: 12px 16px 24px;
    }

    .files-grid.grid-view {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .folders-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .search-input {
        width: 140px;
    }

    .search-input:focus {
        width: 200px;
    }

    .view-toggle {
        display: none;
    }

    .auth-container {
        margin: 16px;
        padding: 32px 24px;
    }

    .auth-features {
        flex-direction: column;
        align-items: center;
    }

    .toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }

    .toast {
        min-width: unset;
        max-width: unset;
    }
}

/* Mobile sidebar overlay */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
}

.sidebar-backdrop.show {
    display: block;
}

/* ═══════════ PREVIEW MODAL ═══════════ */

.modal-preview-container {
    max-width: 900px !important;
    width: 95% !important;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.preview-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.preview-header-info h3 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    min-height: 300px;
}

.preview-media {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.preview-audio {
    width: 80%;
    margin: 40px auto;
}

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

.preview-unsupported svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}

.preview-footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 12px 24px !important;
}
