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

:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bg: #0a0e1a;
  --bg-soft: #0f1424;
  --bg-elevated: #141a2e;
  --bg-deep: #070a14;
  --card: #161d33;
  --card-2: #1a2240;
  --border: #1e2a4a;
  --border-glow: #2a3a6a;
  --text: #e8ecf4;
  --text-soft: #8892a8;
  --text-faint: #5a6480;
  --primary: #00d4ff;
  --primary-dark: #00a8cc;
  --primary-soft: rgba(0, 212, 255, 0.1);
  --primary-glow: rgba(0, 212, 255, 0.3);
  --success: #00e68a;
  --success-soft: rgba(0, 230, 138, 0.1);
  --warning: #ffb800;
  --warning-soft: rgba(255, 184, 0, 0.1);
  --danger: #ff4757;
  --danger-soft: rgba(255, 71, 87, 0.1);
  --info: #6c5ce7;
  --info-soft: rgba(108, 92, 231, 0.1);
  --purple: #a855f7;
  --gradient-1: linear-gradient(135deg, #00d4ff, #6c5ce7);
  --gradient-2: linear-gradient(135deg, #0a0e1a, #141a2e);
  --gradient-3: linear-gradient(135deg, #6c5ce7, #a855f7);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --sidebar-w: 260px;
  --transition: .25s cubic-bezier(.4, 0, .2, 1);
}

[data-theme="light"] {
  --bg: #f0f4f8;
  --bg-soft: #e8edf4;
  --bg-elevated: #ffffff;
  --bg-deep: #eef2f7;
  --card: #ffffff;
  --card-2: #f8fafd;
  --border: #e0e6f0;
  --border-glow: #c0cce0;
  --text: #0f1424;
  --text-soft: #5a6480;
  --text-faint: #8892a8;
  --primary: #0090cc;
  --primary-dark: #0070a0;
  --primary-soft: rgba(0, 144, 204, 0.08);
  --primary-glow: rgba(0, 144, 204, 0.2);
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.08);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.08);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.08);
  --info: #6366f1;
  --info-soft: rgba(99, 102, 241, 0.08);
  --gradient-1: linear-gradient(135deg, #0090cc, #6366f1);
  --gradient-2: linear-gradient(135deg, #f0f4f8, #ffffff);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 30px rgba(0, 144, 204, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ════════════════════════════════════════
   LOGIN & REGISTER PAGE
   ════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  top: -200px; right: -200px;
  animation: floatBlob 15s ease-in-out infinite;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.15), transparent 70%);
  bottom: -100px; left: -100px;
  animation: floatBlob 12s ease-in-out infinite reverse;
}

@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.auth-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.auth-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.auth-brand .brand-logo svg {
  width: 64px; height: 64px;
  filter: drop-shadow(0 0 20px var(--primary-glow));
}

.auth-brand .brand-name {
  font-size: 36px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand .brand-tagline {
  color: var(--text-soft);
  font-size: 16px;
  text-align: center;
  max-width: 400px;
  line-height: 1.8;
}

.auth-brand .cloud-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  opacity: 0.6;
}

.auth-brand .cloud-grid .cloud-icon {
  width: 48px; height: 48px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
  transition: var(--transition);
}

.auth-brand .cloud-grid .cloud-icon:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.auth-form-side {
  width: 480px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-1);
}

.auth-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.auth-card .subtitle {
  color: var(--text-soft);
  font-size: 14px;
  margin-bottom: 28px;
}

.auth-card .logo-mobile {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-card .logo-mobile svg {
  width: 36px; height: 36px;
}

.auth-card .logo-mobile span {
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (max-width: 860px) {
  .auth-brand { display: none; }
  .auth-form-side { width: 100%; }
  .auth-card .logo-mobile { display: flex; }
}

/* ── Form Fields ── */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.form-field {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: var(--transition);
  outline: none;
}

.form-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-field::placeholder { color: var(--text-faint); }

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
}

.form-row a { color: var(--primary); font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-1);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

.btn-secondary:hover {
  background: var(--card);
  border-color: var(--border-glow);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}

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

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid transparent;
}

.btn-success:hover {
  background: var(--success);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-faint);
  font-size: 13px;
}

/* ── Download Cards ── */
.dl-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.dl-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

a.dl-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.dl-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(108, 92, 231, 0.12);
  color: var(--primary);
  flex-shrink: 0;
}

.dl-card-soon .dl-card-icon {
  background: rgba(var(--text-soft-rgb, 150, 150, 150), 0.1);
  color: var(--text-faint);
}

.dl-card-body {
  flex: 1;
  min-width: 0;
}

.dl-card-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 2px;
}

.dl-card-desc {
  font-size: 12px;
  color: var(--text-soft);
}

.dl-card-arrow {
  color: var(--text-faint);
  font-size: 16px;
}

.dl-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 159, 64, 0.15);
  color: #ff9f40;
  white-space: nowrap;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Auth Footer ── */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-soft);
}

.auth-footer a { font-weight: 600; }

/* ════════════════════════════════════════
   APP LAYOUT (Dashboard)
   ════════════════════════════════════════ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar .sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar .sidebar-header svg {
  width: 32px; height: 32px;
  flex-shrink: 0;
}

.sidebar .sidebar-header .brand-text {
  font-size: 18px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.sidebar .nav-section {
  margin-bottom: 8px;
}

.sidebar .nav-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding: 8px 12px 4px;
}

.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.sidebar .nav-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar .nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.sidebar .nav-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.sidebar .nav-item .badge {
  margin-left: auto;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.sidebar .nav-item.danger { color: var(--danger); }
.sidebar .nav-item.danger:hover { background: var(--danger-soft); }

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

.sidebar .storage-info {
  margin-bottom: 12px;
}

.sidebar .storage-info .storage-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.sidebar .storage-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.sidebar .storage-bar .storage-fill {
  height: 100%;
  background: var(--gradient-1);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.sidebar .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar .user-info:hover { background: var(--bg-soft); }

.sidebar .user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .user-email {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
  height: 60px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.navbar .menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}

.navbar .search-box {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.navbar .search-box input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}

.navbar .search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.navbar .search-box input::placeholder { color: var(--text-faint); }

.navbar .search-box i {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 14px;
}

.navbar .navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.navbar .theme-toggle {
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 18px;
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.navbar .theme-toggle:hover {
  background: var(--bg-soft);
  color: var(--primary);
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  padding: 24px;
}

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

.content-header h1 {
  font-size: 22px;
  font-weight: 700;
}

.content-header .breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
}

.content-header .breadcrumb span {
  cursor: pointer;
  transition: var(--transition);
}

.content-header .breadcrumb span:hover { color: var(--primary); }
.content-header .breadcrumb .sep { color: var(--text-faint); }

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

/* ════════════════════════════════════════
   FILTER BAR
   ════════════════════════════════════════ */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.filter-chip i {
  font-size: 11px;
}

.filter-count {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ════════════════════════════════════════
   UPLOAD ZONE
   ════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  background: var(--card);
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-1);
  opacity: 0;
  transition: var(--transition);
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-zone.dragover::before {
  opacity: 0.05;
}

.upload-zone .upload-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.upload-zone .upload-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.upload-zone .upload-hint {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.upload-zone .upload-browse {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

/* ── Upload Mini Button ── */
.upload-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--primary-soft);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-sm);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
}

.upload-mini:hover {
  background: var(--primary);
  color: #fff;
  border-style: solid;
}

/* ── Global Drop Overlay ── */
body.drag-active::after {
  content: 'Drop files here to upload';
  position: fixed;
  inset: 0;
  background: rgba(0, 212, 255, 0.08);
  border: 3px dashed var(--primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  pointer-events: none;
  backdrop-filter: blur(4px);
}

/* ── Upload Progress ── */
.upload-progress-panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.upload-progress-panel.show { display: block; }

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

.upload-progress-panel .progress-title {
  font-size: 14px;
  font-weight: 600;
}

.upload-progress-panel .progress-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-xs);
}

.upload-progress-item .file-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.upload-progress-item .file-info {
  flex: 1;
  min-width: 0;
}

.upload-progress-item .file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-progress-item .file-size {
  font-size: 11px;
  color: var(--text-faint);
}

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

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

.upload-progress-item .status-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.upload-progress-item .status-icon.success { color: var(--success); }
.upload-progress-item .status-icon.error { color: var(--danger); }
.upload-progress-item .status-icon.loading { color: var(--primary); animation: spin 1s linear infinite; }

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ════════════════════════════════════════
   VIEW TOGGLE
   ════════════════════════════════════════ */
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-soft);
  padding: 3px;
  border-radius: var(--radius-xs);
}

.view-toggle button {
  background: none;
  border: none;
  color: var(--text-faint);
  width: 32px; height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle button.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.view-toggle button:hover:not(.active) {
  color: var(--text-soft);
}

/* ════════════════════════════════════════
   FILES LAYOUT + DETAIL PANEL
   ════════════════════════════════════════ */
.files-layout {
  display: flex;
  gap: 20px;
}

.files-main {
  flex: 1;
  min-width: 0;
}

.detail-panel {
  width: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: width 0.3s ease;
  flex-shrink: 0;
}

.detail-panel.open {
  width: 320px;
  padding: 0;
}

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

.detail-header h4 {
  font-size: 14px;
  font-weight: 700;
}

.detail-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

.detail-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-faint);
}

.detail-empty i {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
}

.detail-empty p {
  font-size: 13px;
}

.detail-preview {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.detail-preview img {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius-xs);
}

.detail-preview video {
  width: 100%;
  max-height: 260px;
  border-radius: var(--radius-xs);
  background: #000;
  outline: none;
}

.detail-preview audio {
  width: 100%;
  padding: 20px;
}

.detail-preview audio::-webkit-media-controls-panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
}

.detail-preview .preview-icon {
  font-size: 56px;
  padding: 30px;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
}

.detail-info-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.detail-actions .btn {
  width: 100%;
  justify-content: center;
}

/* ════════════════════════════════════════
   FILE GRID VIEW (Default)
   ════════════════════════════════════════ */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.file-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.file-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

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

.file-card .file-icon-wrap {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 12px;
}

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

.file-card .file-meta {
  font-size: 11px;
  color: var(--text-faint);
}

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

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

.file-card .file-actions button {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 28px; height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-card .file-actions button:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

/* ════════════════════════════════════════
   FILE LARGE GRID VIEW
   ════════════════════════════════════════ */
.files-large {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.file-card-lg {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  position: relative;
}

.file-card-lg:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

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

.file-card-lg .file-preview-lg {
  width: 100%;
  height: 180px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-card-lg .file-preview-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-card-lg .file-preview-lg .preview-icon-lg {
  font-size: 64px;
}

.file-card-lg .file-info-lg {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.file-card-lg .file-name-lg {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-card-lg .file-meta-lg {
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-card-lg .type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

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

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

.file-card-lg .file-actions-lg button {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-card-lg .file-actions-lg button:hover {
  background: var(--primary);
}

/* ════════════════════════════════════════
   FILE LIST VIEW
   ════════════════════════════════════════ */
.files-list {
  display: flex;
  flex-direction: column;
}

.files-list-header {
  display: grid;
  grid-template-columns: 1fr 100px 130px 90px;
  gap: 12px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.file-list-item {
  display: grid;
  grid-template-columns: 1fr 100px 130px 90px;
  gap: 12px;
  padding: 10px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.file-list-item:hover {
  background: var(--primary-soft);
}

.file-list-item.selected {
  background: var(--primary-soft);
}

.file-list-item .file-name-col {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-list-item .file-icon-sm {
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.file-list-item .file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-list-item .file-size,
.file-list-item .file-date {
  font-size: 12px;
  color: var(--text-soft);
}

.file-list-item .file-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}

.file-list-item:hover .file-actions { opacity: 1; }

.file-list-item .file-actions button {
  background: none;
  border: none;
  color: var(--text-faint);
  width: 26px; height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-list-item .file-actions button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ════════════════════════════════════════
   FILE DETAIL VIEW (Table Style)
   ════════════════════════════════════════ */
.files-detail {
  display: flex;
  flex-direction: column;
}

.files-detail-header {
  display: grid;
  grid-template-columns: 40px 1fr 80px 100px 100px 130px 80px;
  gap: 8px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.file-detail-item {
  display: grid;
  grid-template-columns: 40px 1fr 80px 100px 100px 130px 80px;
  gap: 8px;
  padding: 8px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.file-detail-item:hover {
  background: var(--primary-soft);
}

.file-detail-item.selected {
  background: var(--primary-soft);
}

.file-detail-item .file-icon-sm {
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.file-detail-item .file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-detail-item .file-ext,
.file-detail-item .file-size,
.file-detail-item .file-type,
.file-detail-item .file-date {
  font-size: 12px;
  color: var(--text-soft);
}

.file-detail-item .file-ext {
  font-weight: 600;
  text-transform: uppercase;
}

.file-detail-item .file-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: var(--transition);
}

.file-detail-item:hover .file-actions { opacity: 1; }

.file-detail-item .file-actions button {
  background: none;
  border: none;
  color: var(--text-faint);
  width: 26px; height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.file-detail-item .file-actions button:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

/* ── Folder Card ── */
.folder-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
}

.folder-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.folder-card .folder-icon {
  font-size: 24px;
  color: var(--warning);
}

.folder-card .folder-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ════════════════════════════════════════
   FILE ICONS BY TYPE
   ════════════════════════════════════════ */
.icon-image { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.icon-video { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.icon-audio { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.icon-pdf { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.icon-doc { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.icon-xls { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.icon-zip { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.icon-code { background: rgba(0, 212, 255, 0.1); color: #00d4ff; }
.icon-file { background: var(--bg-soft); color: var(--text-soft); }
.icon-folder { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }

/* ════════════════════════════════════════
   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: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.lightbox-stage {
  width: 94%;
  height: 94%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  font-weight: 600;
  padding: 8px 4px;
  min-height: 40px;
  gap: 12px;
}

.lightbox-topbar span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-stage .modal-close {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 20px;
}

.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-xs);
  cursor: zoom-in;
  transition: transform 0.15s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-content img.zoomed {
  cursor: grab;
}

.lightbox-content img.zoomed.dragging {
  cursor: grabbing;
}

.lightbox-content video {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-xs);
}

.detail-preview-img {
  max-width: 100%;
  max-height: 300px;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.detail-preview-img:hover {
  opacity: 0.85;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
}

/* ── Code Editor ── */
.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.editor-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.editor-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 860px;
  height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  transition: var(--transition);
}

.editor-overlay.open .editor-modal {
  transform: translateY(0) scale(1);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
}

.editor-header .modal-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 18px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-header .modal-close:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

#editorTextarea {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  font-size: 13.5px;
  line-height: 1.65;
  padding: 16px 20px;
  tab-size: 2;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.editor-status {
  font-size: 12px;
  color: var(--text-faint);
}

.editor-status.ok { color: #2ecc71; }
.editor-status.err { color: #e74c3c; }

.editor-buttons {
  display: flex;
  gap: 8px;
}

@media (max-width: 640px) {
  .editor-modal { height: 90vh; width: 95%; }
  .editor-footer { flex-direction: column; align-items: stretch; }
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-header .modal-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 20px;
  cursor: pointer;
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-header .modal-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

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

/* ════════════════════════════════════════
   CONTEXT MENU
   ════════════════════════════════════════ */
.context-menu {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: none;
}

.context-menu.show { display: block; }

.context-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  transition: var(--transition);
}

.context-menu .ctx-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.context-menu .ctx-item.danger { color: var(--danger); }
.context-menu .ctx-item.danger:hover { background: var(--danger-soft); }

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

/* ════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: slideInRight 0.3s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }

.toast .toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--info); }

.toast .toast-msg {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
}

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

/* ════════════════════════════════════════
   ADMIN PANEL
   ════════════════════════════════════════ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-soft);
}

/* ── Settings Panel ── */
.settings-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.settings-panel h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.settings-row .setting-label {
  font-size: 14px;
  font-weight: 500;
}

.settings-row .setting-desc {
  font-size: 12px;
  color: var(--text-faint);
}

/* ── Switch Toggle ── */
.switch {
  position: relative;
  width: 44px;
  height: 24px;
}

.switch input { display: none; }

.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.switch .slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: var(--transition);
}

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

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}

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

.empty-state .empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 4px;
}

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

/* ════════════════════════════════════════
   SHARED PAGE
   ════════════════════════════════════════ */
.shared-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.shared-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.shared-card .shared-icon {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 16px;
}

.shared-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.shared-card .file-info {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 24px;
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content {
    margin-left: 0;
  }
  .navbar .menu-toggle {
    display: flex;
  }
  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .files-list-header,
  .file-list-item {
    grid-template-columns: 1fr 80px 60px;
  }
  .files-list-header > :nth-child(3),
  .file-list-item > :nth-child(3) {
    display: none;
  }
}

@media (max-width: 480px) {
  .content-area { padding: 16px; }
  .content-header { flex-direction: column; align-items: flex-start; }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .upload-zone { padding: 24px; }
}

/* ════════════════════════════════════════
   TABLE (Admin)
   ════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.data-table tr:hover td {
  background: var(--primary-soft);
}

.data-table .role-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.data-table .role-badge.admin {
  background: var(--info-soft);
  color: var(--info);
}

.data-table .role-badge.user {
  background: var(--success-soft);
  color: var(--success);
}

/* ── Sidebar overlay on mobile ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

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

/* ── User Menu Dropdown ── */
.user-menu {
  position: absolute;
  bottom: 70px;
  left: 16px;
  right: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
}

.user-menu.show {
  display: block;
  animation: menuSlideUp 0.2s ease;
}

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

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px 14px;
}

.user-menu-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: var(--transition);
}

.user-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-menu-avatar .avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
  font-size: 14px;
}

.user-menu-avatar:hover .avatar-overlay {
  opacity: 1;
}

.user-menu-info {
  flex: 1;
  min-width: 0;
}

.user-menu-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-email {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  transition: var(--transition);
}

.user-menu .ctx-item i {
  width: 16px;
  text-align: center;
}

.user-menu .ctx-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.user-menu .ctx-item.danger { color: var(--danger); }
.user-menu .ctx-item.danger:hover { background: var(--danger-soft); }

.user-menu .ctx-divider {
  margin: 8px 0;
}

/* ── Multi-select mode ── */
.sel-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  color: var(--text-faint);
  font-size: 16px;
  cursor: pointer;
  background: rgba(0,0,0,0.35);
  border-radius: 4px;
  line-height: 1;
  padding: 2px;
  backdrop-filter: blur(2px);
}
.sel-checkbox:hover { color: var(--accent); }
.sel-checkbox.checked { color: var(--accent); }
.file-card.sel, .file-card-lg.sel, .file-list-item.sel, .file-detail-item.sel, .folder-card.sel {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-glow) !important;
}
.file-card .sel-checkbox, .file-card-lg .sel-checkbox, .folder-card .sel-checkbox {
  top: 10px; left: 10px;
}
.file-list-item .sel-checkbox, .file-detail-item .sel-checkbox {
  position: static;
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  background: transparent;
  font-size: 14px;
}
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.selection-bar #selectionCount {
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
}
.selection-bar .selection-actions {
  display: flex;
  gap: 8px;
}

.move-tree {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--bg-soft);
}

.move-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.move-option:hover {
  background: var(--primary-soft);
}

.move-option input[type="radio"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.move-option label {
  cursor: pointer;
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Notes / Snippet page ── */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.note-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.note-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-lg);
}

.note-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.note-card-title {
  font-weight: 700;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.note-card-actions .btn-ghost {
  padding: 4px 8px;
  font-size: 11px;
}

.note-card-actions .danger-text {
  color: var(--danger);
}

.note-card-meta {
  font-size: 11px;
  color: var(--text-faint);
}

.note-code {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: Consolas, Menlo, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  cursor: text;
  user-select: text;
}

.notes-modal {
  max-width: 620px;
}

.notes-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
