/* ================================================================
   LynSync — Premium Dark Glassmorphism Design System
   Font: Inter (Google Fonts)
   ================================================================ */

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

/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
  --bg-0:        #070711;
  --bg-1:        #0d0e1f;
  --bg-2:        #12132a;
  --surface:     rgba(255,255,255,0.04);
  --surface-2:   rgba(255,255,255,0.07);
  --surface-3:   rgba(255,255,255,0.11);
  --border:      rgba(255,255,255,0.08);
  --border-2:    rgba(255,255,255,0.14);

  --primary:       #6366f1;
  --primary-light: #818cf8;
  --primary-dark:  #4f46e5;
  --secondary:     #a78bfa;
  --accent:        #22d3ee;
  --success:       #10b981;
  --warning:       #f59e0b;
  --error:         #f43f5e;

  --text:          #e2e8f0;
  --text-muted:    #94a3b8;
  --text-dim:      #475569;

  --radius-xs:   6px;
  --radius-sm:   10px;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-full: 9999px;

  --shadow-sm:   0 2px 12px rgba(0,0,0,0.25);
  --shadow:      0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg:   0 8px 48px rgba(0,0,0,0.45);
  --glow:        0 0 40px rgba(99,102,241,0.18);
  --glow-sm:     0 0 20px rgba(99,102,241,0.12);

  --sidebar-w:   260px;
  --topbar-h:    64px;
  --transition:  200ms cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-0);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Animated Background ──────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99,102,241,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 90%, rgba(139,92,246,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(34,211,238,0.04) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  from { opacity: 0.7; }
  to   { opacity: 1;   }
}

/* ── Floating Orbs ───────────────────────────────────────────── */
.orb {
  position: fixed;
  border-radius: var(--radius-full);
  filter: blur(80px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.4;
  animation: orbFloat 20s ease-in-out infinite alternate;
}
.orb-1 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(99,102,241,0.35), transparent); top: -100px; left: -100px; animation-duration: 18s; }
.orb-2 { width: 350px; height: 350px; background: radial-gradient(circle, rgba(167,139,250,0.25), transparent); bottom: -80px; right: -80px; animation-duration: 22s; animation-delay: -8s; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(34,211,238,0.15), transparent); top: 50%; right: 20%; animation-duration: 25s; animation-delay: -4s; }

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -40px) scale(1.05); }
}

/* ── Particles (auth page) ───────────────────────────────────── */
.bg-particles { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.particle {
  position: absolute;
  width: 2px; height: 2px;
  background: rgba(99,102,241,0.5);
  border-radius: 50%;
  animation: particleDrift linear infinite;
}
.particle:nth-child(1)  { left: 15%; top: 80%; animation-duration: 20s; animation-delay:   0s; width: 3px; height: 3px; }
.particle:nth-child(2)  { left: 35%; top: 70%; animation-duration: 25s; animation-delay:  -5s; }
.particle:nth-child(3)  { left: 55%; top: 90%; animation-duration: 18s; animation-delay:  -2s; background: rgba(167,139,250,0.5); }
.particle:nth-child(4)  { left: 70%; top: 75%; animation-duration: 22s; animation-delay:  -8s; }
.particle:nth-child(5)  { left: 85%; top: 60%; animation-duration: 30s; animation-delay: -15s; background: rgba(34,211,238,0.4); width: 3px; height: 3px; }
.particle:nth-child(6)  { left: 5%;  top: 50%; animation-duration: 26s; animation-delay: -10s; }

@keyframes particleDrift {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-100vh) translateX(40px); opacity: 0; }
}

/* ============================================================
   AUTH PAGE
   ============================================================ */

.auth-body { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }

.auth-container { width: 100%; max-width: 440px; }

/* Brand */
.auth-brand { text-align: center; margin-bottom: 32px; }
.brand-icon  {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  margin-bottom: 12px;
  box-shadow: var(--glow-sm);
}
.brand-icon--sm { width: 40px; height: 40px; }
.brand-name { display: block; font-size: 28px; font-weight: 800; letter-spacing: -0.5px; background: linear-gradient(135deg, #fff 0%, #a78bfa 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.brand-tagline { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Auth Card */
.auth-card {
  background: rgba(13,14,31,0.7);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg), var(--glow);
}

/* Tabs */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
  position: relative;
  margin-bottom: 28px;
  overflow: hidden;
}
.auth-tab {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 9px 16px; border-radius: calc(var(--radius) - 2px);
  position: relative; z-index: 1; transition: color var(--transition);
}
.auth-tab.active { color: var(--text); }
.auth-tab-indicator {
  position: absolute; top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  background: var(--surface-3); border-radius: calc(var(--radius) - 3px);
  transition: transform 200ms cubic-bezier(0.4,0,0.2,1);
  border: 1px solid var(--border-2);
}

/* Messages */
.auth-message {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px;
  animation: fadeSlideIn 200ms ease;
}
.auth-message--error   { background: rgba(244,63,94,0.12);  border: 1px solid rgba(244,63,94,0.3);  color: #fb7185; }
.auth-message--success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.auth-message--info    { background: rgba(99,102,241,0.12); border: 1px solid rgba(99,102,241,0.3); color: #818cf8; }

/* Form */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-muted); }

.input-wrapper {
  position: relative; display: flex; align-items: center;
}
.input-wrapper input,
.input-wrapper select {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrapper select { padding-left: 14px; cursor: pointer; }
.input-wrapper input:focus,
.input-wrapper select:focus {
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.input-wrapper input::placeholder { color: var(--text-dim); }
.input-icon {
  position: absolute; left: 12px; width: 16px; height: 16px;
  color: var(--text-dim); pointer-events: none;
}
.input-toggle-vis {
  position: absolute; right: 10px; padding: 4px;
  background: none; border: none; cursor: pointer; color: var(--text-dim);
  display: flex;
}
.input-toggle-vis svg { width: 16px; height: 16px; }

/* Password strength */
.password-strength { height: 3px; background: var(--surface-3); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pw-bar { height: 100%; width: 0; border-radius: 2px; transition: width 300ms ease, background 300ms ease; }
.pw-label { font-size: 11px; margin-top: 3px; }

/* E2E notice */
.e2e-notice {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; background: rgba(16,185,129,0.07);
  border: 1px solid rgba(16,185,129,0.2); border-radius: var(--radius-sm);
  font-size: 12px; color: #6ee7b7; line-height: 1.4;
}
.e2e-notice svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 11px 20px; font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; position: relative; overflow: hidden; transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(99,102,241,0.35); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary svg { width: 16px; height: 16px; }

.btn-upload {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #22d3ee, #6366f1);
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 9px 18px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-upload:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(34,211,238,0.3); }
.btn-upload svg { width: 15px; height: 15px; }

.btn-ghost {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
  border-radius: var(--radius-sm); padding: 9px 16px; font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer;
  transition: all var(--transition); flex-shrink: 0;
}
.btn-icon:hover  { background: var(--surface-2); color: var(--text); }
.btn-icon.active { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); color: var(--primary-light); }
.btn-icon svg { width: 16px; height: 16px; }

.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius); }
.btn-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}

/* Auth footer */
.auth-footer {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 20px; font-size: 12px; color: var(--text-dim);
}
.auth-footer svg { width: 14px; height: 14px; color: var(--success); }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */

.dashboard-body {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: rgba(13,14,31,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 8px;
  flex-shrink: 0;
  transition: transform var(--transition);
  z-index: 100;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-logo-text { font-size: 18px; font-weight: 800; background: linear-gradient(135deg, #fff, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: all var(--transition);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: rgba(99,102,241,0.15);
  color: var(--primary-light);
  border-left: 2px solid var(--primary);
  margin-left: -2px;
  padding-left: 14px;
}

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 0; }

/* Storage widget */
.storage-widget { padding: 0 4px 8px; }
.storage-label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.storage-pct { font-weight: 600; font-size: 11px; }
.storage-pct--warn { color: var(--error); }
.storage-bar { height: 5px; background: var(--surface-3); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 5px; }
.storage-fill { height: 100%; border-radius: var(--radius-full); transition: width 600ms cubic-bezier(0.4,0,0.2,1); }
.storage-detail { font-size: 11px; color: var(--text-dim); }

/* Profile */
.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px; border-radius: var(--radius-sm);
  border-top: 1px solid var(--border); margin-top: auto;
}
.profile-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.profile-info { flex: 1; overflow: hidden; }
.profile-name  { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-email { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-logout {
  color: var(--text-dim); width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs); text-decoration: none; transition: all var(--transition); flex-shrink: 0;
}
.profile-logout:hover { background: rgba(244,63,94,0.15); color: var(--error); }
.profile-logout svg { width: 16px; height: 16px; }

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

/* ── Top Bar ──────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 24px;
  background: rgba(7,7,17,0.6); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: var(--radius-xs); }
.sidebar-toggle svg { width: 20px; height: 20px; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: nowrap; overflow: hidden; }
.breadcrumb-item { font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.breadcrumb-item:hover { color: var(--text); }
.breadcrumb-item.active { color: var(--text); cursor: default; }
.breadcrumb-sep { color: var(--text-dim); font-size: 14px; }

/* Search */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  width: 260px; transition: all var(--transition);
}
.search-box:focus-within { border-color: rgba(99,102,241,0.5); box-shadow: 0 0 0 3px rgba(99,102,241,0.08); width: 300px; }
.search-box svg { width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
.search-box input { background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 13px; width: 100%; }
.search-box input::placeholder { color: var(--text-dim); }

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

/* ── Content Area ──────────────────────────────────────────────── */
.content-area { flex: 1; overflow-y: auto; padding: 24px; position: relative; }

/* Custom scrollbar */
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.content-area::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Drop overlay ─────────────────────────────────────────────── */
.drop-overlay {
  position: absolute; inset: 0;
  background: rgba(7,7,17,0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 50; border-radius: var(--radius);
  border: 2px dashed rgba(99,102,241,0.5);
}
.drop-overlay.active { opacity: 1; pointer-events: all; }
.drop-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.drop-overlay-inner svg { width: 80px; height: 80px; animation: dropBounce 1s ease-in-out infinite alternate; }
.drop-overlay-inner p { font-size: 18px; font-weight: 600; color: var(--primary-light); }

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

/* ── File Grid ──────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  animation: fadeIn 300ms ease;
}
.file-grid--list {
  grid-template-columns: 1fr;
  gap: 8px;
}

/* File Card */
.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  animation: cardSlideIn 300ms ease both;
}
.file-card:hover {
  background: var(--surface-2);
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.file-card:hover .file-card-actions { opacity: 1; }

/* List mode card */
.file-grid--list .file-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); }
.file-grid--list .file-card-thumb { width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-xs); overflow: hidden; }
.file-grid--list .file-card-thumb svg { width: 40px; height: 40px; }
.file-grid--list .file-card-info { flex: 1; min-width: 0; }
.file-grid--list .file-card-name { display: block; }
.file-grid--list .file-card-actions { position: static; opacity: 1; background: none; padding: 0; flex-shrink: 0; gap: 4px; }

.file-card-thumb {
  width: 100%; aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--bg-1); position: relative;
}
.file-card-thumb svg { width: 64px; height: 64px; }
.file-card-thumb img, .file-card-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

.folder-thumb { background: rgba(99,102,241,0.05); }
.folder-thumb svg { width: 56px; height: 56px; }

.file-preview-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4); opacity: 0; transition: opacity var(--transition);
  color: rgba(255,255,255,0.9);
}
.file-preview-overlay svg { width: 32px; height: 32px; }
.file-card:hover .file-preview-overlay { opacity: 1; }

.file-card-info { padding: 10px 12px 12px; }
.file-card-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; margin-bottom: 3px;
}
.file-card-meta { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.file-shared-badge {
  display: inline-block; background: rgba(34,211,238,0.15); color: var(--accent);
  border: 1px solid rgba(34,211,238,0.3); border-radius: 4px;
  padding: 1px 5px; font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
}

.file-card-actions {
  position: absolute; top: 0; right: 0;
  display: flex; align-items: center; gap: 4px; padding: 8px;
  opacity: 0; transition: opacity var(--transition);
  background: linear-gradient(to bottom right, rgba(13,14,31,0.9), rgba(13,14,31,0.6));
  border-bottom-left-radius: var(--radius);
}
.file-action-btn {
  width: 28px; height: 28px; border-radius: var(--radius-xs);
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.file-action-btn:hover { background: var(--surface-3); color: var(--text); }
.file-action-btn--danger:hover { background: rgba(244,63,94,0.2); color: var(--error); border-color: rgba(244,63,94,0.4); }
.file-action-btn svg { width: 14px; height: 14px; }

/* Folder card */
.folder-card { cursor: pointer; }

/* Skeleton loading */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,0.04) 50%, transparent 70%);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 80px 40px; text-align: center; min-height: 60vh;
}
.empty-state svg { width: 120px; height: 120px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); }
.empty-state p  { font-size: 14px; color: var(--text-muted); max-width: 320px; }

/* ── Upload Panel ───────────────────────────────────────────────── */
.upload-panel {
  position: fixed; bottom: 24px; right: 24px;
  width: 360px; background: rgba(13,14,31,0.95);
  backdrop-filter: blur(20px); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 200; overflow: hidden;
  animation: slideUp 300ms ease;
}
.upload-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600;
}
.upload-panel-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; }
.upload-panel-header button svg { width: 16px; height: 16px; }
.upload-panel-header button:hover { color: var(--text); }
.upload-list { max-height: 300px; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.upload-item { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); animation: fadeSlideIn 200ms ease; }
.upload-item--done { opacity: 0.6; }
.upload-item-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.upload-item-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.upload-item-size { font-size: 11px; color: var(--text-dim); flex-shrink: 0; margin-left: 8px; }
.upload-item-progress { display: flex; flex-direction: column; gap: 4px; }
.upload-progress-bar { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 2px; transition: width 100ms ease; }
.upload-item-status { font-size: 11px; color: var(--text-dim); }
.upload-item-status--encrypting { color: var(--warning); }
.upload-item-status--uploading  { color: var(--accent); }
.upload-item-status--done       { color: var(--success); }
.upload-item-status--error      { color: var(--error); }

/* ── Lightbox ───────────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(20px);
  opacity: 0; transition: opacity 300ms ease;
}
.lightbox--visible { opacity: 1; }

.lightbox-content {
  max-width: min(90vw, 1200px); max-height: 85vh;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.lightbox-img   { max-width: 100%; max-height: 85vh; border-radius: var(--radius); object-fit: contain; box-shadow: var(--shadow-lg); }
.lightbox-video { max-width: 90vw; max-height: 80vh; border-radius: var(--radius); outline: none; box-shadow: var(--shadow-lg); }
.lightbox-pdf   { width: min(80vw, 900px); height: 80vh; border: none; border-radius: var(--radius); }
.lightbox-audio-wrapper { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.lightbox-audio-icon svg { width: 80px; height: 80px; }
.lightbox-audio { width: 360px; }
.lightbox-generic { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px; text-align: center; }
.lightbox-generic .lightbox-file-icon svg { width: 80px; height: 80px; }
.lightbox-filename { font-size: 16px; font-weight: 600; }
.lightbox-filesize { font-size: 13px; color: var(--text-muted); }
.lightbox-error { padding: 40px; text-align: center; color: var(--error); }

.lightbox-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

.lightbox-close {
  position: fixed; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none;
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition); z-index: 510;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
.lightbox-close svg { width: 18px; height: 18px; }

.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none;
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition); z-index: 510;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-nav svg { width: 20px; height: 20px; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-info {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px);
  padding: 6px 16px; border-radius: var(--radius-full);
  font-size: 13px; color: rgba(255,255,255,0.8);
  max-width: 80vw; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Context Menu ───────────────────────────────────────────────── */
.context-menu {
  position: fixed; z-index: 300;
  background: rgba(13,14,31,0.95); backdrop-filter: blur(20px);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: 6px; min-width: 160px;
  box-shadow: var(--shadow-lg);
  animation: fadeSlideIn 150ms ease;
}
.context-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 12px;
  background: none; border: none; border-radius: var(--radius-xs);
  color: var(--text-muted); font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; text-align: left; transition: all var(--transition);
}
.context-menu button svg { width: 15px; height: 15px; flex-shrink: 0; }
.context-menu button:hover { background: var(--surface-2); color: var(--text); }
.context-menu .ctx-danger:hover { background: rgba(244,63,94,0.1); color: var(--error); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Modals ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 200ms ease;
  padding: 20px;
}
.modal-card {
  background: rgba(13,14,31,0.98); backdrop-filter: blur(20px);
  border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  padding: 28px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 200ms ease;
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Share link box */
.share-link-box {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
}
.share-link-box input {
  flex: 1; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 12px; outline: none;
}

/* ── Toast Notifications ─────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 600;
  pointer-events: none;
}
.toast {
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px;
  backdrop-filter: blur(12px); transform: translateY(20px); opacity: 0;
  transition: all 300ms cubic-bezier(0.4,0,0.2,1);
  box-shadow: var(--shadow-lg); white-space: nowrap;
}
.toast--visible { transform: translateY(0); opacity: 1; }
.toast--success { background: rgba(16,185,129,0.15);  border: 1px solid rgba(16,185,129,0.3);  color: #6ee7b7; }
.toast--error   { background: rgba(244,63,94,0.15);   border: 1px solid rgba(244,63,94,0.3);   color: #fda4af; }
.toast--info    { background: rgba(99,102,241,0.15);  border: 1px solid rgba(99,102,241,0.3);  color: #a5b4fc; }
.toast--warning { background: rgba(245,158,11,0.15);  border: 1px solid rgba(245,158,11,0.3);  color: #fcd34d; }
.toast-icon { font-size: 15px; }

/* ============================================================
   SHARED PAGE
   ============================================================ */

.shared-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.shared-container { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 16px; }

.shared-header { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; color: var(--text-muted); }

.shared-card { padding: 36px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.glass-card {
  background: rgba(13,14,31,0.75); backdrop-filter: blur(24px);
  border: 1px solid var(--border-2); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.shared-file-icon svg { width: 64px; height: 64px; }
.shared-filename { font-size: 20px; font-weight: 700; word-break: break-all; }
.shared-meta { font-size: 13px; color: var(--text-muted); }

.shared-preview { width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--bg-1); min-height: 120px; display: flex; align-items: center; justify-content: center; }
.shared-preview-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px; }
.shared-preview-loading p { font-size: 13px; color: var(--text-muted); }
.shared-preview-img   { max-width: 100%; max-height: 60vh; border-radius: var(--radius); }
.shared-preview-video { max-width: 100%; max-height: 60vh; border-radius: var(--radius); outline: none; }
.shared-preview-audio { width: 100%; }

.shared-e2e-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2); border-radius: var(--radius-sm);
  font-size: 12px; color: #6ee7b7; line-height: 1.4;
  width: 100%; text-align: left;
}
.shared-e2e-badge svg { width: 16px; height: 16px; flex-shrink: 0; }
.shared-actions { display: flex; gap: 12px; width: 100%; }
.shared-actions .btn-primary { width: 100%; justify-content: center; }
.shared-footer { text-align: center; font-size: 13px; color: var(--text-dim); }
.shared-footer a { color: var(--primary-light); text-decoration: none; }
.shared-footer a:hover { text-decoration: underline; }

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp     { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn     { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes spin        { to { transform: rotate(360deg); } }
@keyframes cardSlideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }

  .main-content { width: 100%; }

  .topbar { padding: 0 16px; gap: 8px; }
  .search-box { width: auto; flex: 1; }
  .search-box:focus-within { width: auto; }

  .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .content-area { padding: 16px; }

  .upload-panel { width: calc(100vw - 32px); bottom: 16px; right: 16px; }

  .lightbox-nav { display: none; }
}

@media (max-width: 480px) {
  .topbar-actions .btn-icon { display: none; }
  .topbar-actions .btn-primary { padding: 8px 12px; font-size: 13px; }
  .file-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Selection styles ──────────────────────────────────────────── */
::selection { background: rgba(99,102,241,0.3); color: #fff; }
