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

/* ═══ Theme Variables ═══ */
:root, [data-theme="dark"] {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-input: rgba(31, 41, 55, 0.6);
  --border: rgba(75, 85, 99, 0.4);
  --border-hover: rgba(99, 102, 241, 0.5);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --dropbox: #0061fe;
  --onedrive: #0078d4;
  --local: #10b981;
  --shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(243, 244, 246, 0.95);
  --bg-input: rgba(243, 244, 246, 0.8);
  --border: rgba(209, 213, 219, 0.6);
  --border-hover: rgba(99, 102, 241, 0.4);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.12);
  --shadow: rgba(0, 0, 0, 0.08);
}

:root {
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* ═══ Layout ═══ */
.app { display: none; height: 100vh; }

/* ═══ Login Screen ═══ */
#login-screen {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background: #131a2e;
  overflow: hidden;
}
[data-theme="light"] .login-bg { background: #e8ecf4; }
.login-bg canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.login-bg .gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.7;
  animation: float 8s ease-in-out infinite;
}
.login-bg .orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.8), transparent 70%);
  top: -150px; left: -100px;
  animation-delay: 0s;
}
.login-bg .orb2 {
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.7), transparent 70%);
  bottom: -120px; right: -80px;
  animation-delay: -3s;
}
.login-bg .orb3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.6), transparent 70%);
  top: 40%; left: 55%;
  animation-delay: -5s;
}
[data-theme="light"] .login-bg .gradient-orb { opacity: 0.4; filter: blur(80px); }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}
.login-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 32px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 25px 60px var(--shadow), 0 0 0 1px rgba(255,255,255,0.05) inset;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}
.login-logo h1 {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}
.login-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  transition: 0.6s;
}
.login-btn:hover::after { transform: translateX(100%); }
.theme-toggle-login {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
.theme-pill {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}
.theme-pill button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.theme-pill button.active {
  background: var(--accent);
  color: white;
}

/* ═══ Sidebar ═══ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  transition: width 0.3s, background 0.3s;
}
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.sidebar-brand span {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sidebar-nav { flex: 1; padding: 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  user-select: none;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent-hover); }
.nav-item.active svg { stroke: var(--accent-hover); }
.nav-item svg { width: 20px; height: 20px; stroke: var(--text-secondary); stroke-width: 2; fill: none; transition: var(--transition); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-footer-left { display: flex; align-items: center; gap: 6px; }
.sidebar-footer-right { display: flex; align-items: center; gap: 6px; }

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status-dot.healthy { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.degraded { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.error { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.theme-btn, .logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
  line-height: 1;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ═══ Main Content ═══ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
  transition: background 0.3s;
}
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-secondary);
  transition: background 0.3s;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══ Cards ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}
.card-body { padding: 18px; }

/* ═══ Dashboard ═══ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.remote-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: var(--transition);
  cursor: pointer;
}
.remote-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: 0 8px 25px var(--shadow); }
.remote-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.remote-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.remote-type {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.remote-type.dropbox { background: rgba(0, 97, 254, 0.15); color: var(--dropbox); }
.remote-type.onedrive { background: rgba(0, 120, 212, 0.15); color: var(--onedrive); }
.remote-type.local { background: rgba(16, 185, 129, 0.15); color: var(--local); }
.storage-bar { height: 6px; background: var(--bg-input); border-radius: 3px; margin: 10px 0 6px; overflow: hidden; }
.storage-bar-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }
.storage-bar-fill.dropbox { background: linear-gradient(90deg, var(--dropbox), #4da3ff); }
.storage-bar-fill.onedrive { background: linear-gradient(90deg, var(--onedrive), #47b5ff); }
.storage-bar-fill.local { background: linear-gradient(90deg, var(--local), #6ee7b7); }
.storage-info { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); }

/* ═══ Explorer ═══ */
.explorer-container {
  display: grid;
  grid-template-columns: 1fr 46px 1fr;
  gap: 0;
  height: calc(100vh - 136px);
}
.explorer-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.3s;
}
.explorer-panel.drag-over { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }
.panel-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.panel-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.panel-select:focus { border-color: var(--accent); }
.panel-select option { background: var(--bg-secondary); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  white-space: nowrap;
}
.breadcrumb span { cursor: pointer; transition: var(--transition); }
.breadcrumb span:hover { color: var(--accent-hover); }
.breadcrumb .sep { color: var(--text-muted); margin: 0 2px; }
.file-list { flex: 1; overflow-y: auto; padding: 2px 0; }
.file-list::-webkit-scrollbar { width: 4px; }
.file-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.file-item {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  gap: 8px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.08);
}
.file-item:hover { background: var(--bg-card-hover); }
.file-item.selected { background: var(--accent-glow); }
.file-item.dragging { opacity: 0.4; }
.file-item.drag-ghost { background: var(--accent); color: white; border-radius: var(--radius-sm); }
.file-icon { width: 18px; height: 18px; flex-shrink: 0; }
.file-icon.folder { color: var(--warning); }
.file-icon.file { color: var(--text-muted); }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-muted); font-size: 11px; min-width: 55px; text-align: right; }
.file-date { color: var(--text-muted); font-size: 11px; min-width: 50px; text-align: right; }

.explorer-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.action-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.action-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }
.action-btn svg { width: 15px; height: 15px; }

/* ═══ Transfers ═══ */
.transfer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.transfer-item:hover { background: var(--bg-card-hover); }
.transfer-item:last-child { border-bottom: none; }
.transfer-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.transfer-icon.copy { background: rgba(59, 130, 246, 0.15); }
.transfer-icon.move { background: rgba(245, 158, 11, 0.15); }
.transfer-icon.sync { background: rgba(16, 185, 129, 0.15); }
.transfer-info { flex: 1; min-width: 0; }
.transfer-name { font-weight: 500; font-size: 13px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-detail { font-size: 11px; color: var(--text-secondary); }
.transfer-progress { width: 100px; flex-shrink: 0; }
.progress-bar { height: 4px; background: var(--bg-input); border-radius: 2px; overflow: hidden; margin-bottom: 3px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 2px; transition: width 0.5s ease; }
.progress-text { font-size: 10px; color: var(--text-muted); text-align: right; }
.transfer-status { min-width: 70px; text-align: center; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.badge.running { background: rgba(99, 102, 241, 0.15); color: var(--accent-hover); }
.badge.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge.error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* ═══ Schedules ═══ */
.schedule-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.schedule-item:last-child { border-bottom: none; }
.schedule-info { flex: 1; }
.schedule-name { font-weight: 500; font-size: 14px; margin-bottom: 2px; }
.schedule-detail { font-size: 12px; color: var(--text-secondary); }
.toggle { position: relative; width: 40px; height: 22px; background: var(--bg-input); border-radius: 11px; cursor: pointer; transition: var(--transition); border: 1px solid var(--border); flex-shrink: 0; }
.toggle.active { background: var(--accent); border-color: var(--accent); }
.toggle::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: var(--transition); }
.toggle.active::after { left: 20px; }

/* ═══ Buttons ═══ */
.btn { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; transition: var(--transition); border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 15px var(--accent-glow); }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-hover); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

/* ═══ Empty/Loading/Spinner ═══ */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; color: var(--text-muted); text-align: center; }
.empty-state svg { width: 44px; height: 44px; margin-bottom: 14px; opacity: 0.4; }
.empty-state p { font-size: 13px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 40px; }

/* ═══ Modal ═══ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fadeIn 0.2s ease; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); width: 90%; max-width: 460px; max-height: 80vh; overflow-y: auto; animation: slideUp 0.3s ease; }
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.modal-body { padding: 18px; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ Toast ═══ */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-secondary); border: 1px solid var(--border); font-size: 13px; min-width: 260px; display: flex; align-items: center; gap: 8px; animation: slideIn 0.3s ease; box-shadow: 0 8px 25px var(--shadow); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ═══ Form ═══ */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.form-input { width: 100%; padding: 9px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 13px; font-family: inherit; outline: none; transition: var(--transition); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ═══ Stats ═══ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-value { font-size: 22px; font-weight: 700; margin-bottom: 2px; }
.stat-label { font-size: 11px; color: var(--text-secondary); }

/* ═══ Drop zone indicator ═══ */
.drop-indicator {
  position: absolute;
  inset: 0;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-hover);
  pointer-events: none;
  z-index: 5;
  animation: fadeIn 0.2s ease;
}

/* ═══ Responsive ═══ */
@media (max-width: 1024px) {
  .explorer-container { height: calc(100vh - 130px); }
  .file-date { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 60px;
    z-index: 50;
  }
  .sidebar .nav-text, .sidebar-brand span, .sidebar-footer span { display: none; }
  .sidebar-header { padding: 12px 10px; }
  .sidebar-brand img { width: 32px; height: 32px; }
  .nav-item { justify-content: center; padding: 10px; gap: 0; }
  .sidebar-footer { flex-direction: column; gap: 6px; padding: 8px; }
  .sidebar-footer-left span { display: none; }

  .main { margin-left: 60px; }
  .topbar { padding: 0 14px; height: 50px; }
  .topbar-title { font-size: 16px; }
  .content { padding: 12px; }

  .explorer-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
    height: calc(100vh - 122px);
  }
  .explorer-actions { flex-direction: row; padding: 6px 0; }
  .file-date { display: none; }
  .file-size { min-width: 45px; font-size: 10px; }
  .file-item { padding: 6px 10px; font-size: 12px; }
  .panel-header { padding: 8px 10px; }

  .dashboard-grid { grid-template-columns: 1fr; gap: 12px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }

  .transfer-progress { width: 70px; }
  .transfer-item { padding: 10px 12px; gap: 8px; }

  .login-card { padding: 28px 20px; }
  .login-logo img { width: 56px; height: 56px; }
  .login-logo h1 { font-size: 22px; }
}

@media (max-width: 480px) {
  .sidebar { width: 50px; }
  .sidebar-brand img { width: 28px; height: 28px; }
  .main { margin-left: 50px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 18px; }
  .content { padding: 10px; }
  .topbar { padding: 0 10px; }
  .transfer-progress { display: none; }
}

/* ═══ File Preview ═══ */
.file-item.previewable { cursor: pointer; }
.file-preview-btn {
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.file-item:hover .file-preview-btn,
.file-item.previewable:hover .file-preview-btn { opacity: 0.7; }
.file-preview-btn:hover { opacity: 1 !important; background: var(--bg-tertiary); }

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.preview-modal {
  width: 90vw;
  max-width: 1000px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: scaleIn 0.2s ease-out;
}
@keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}
.preview-controls { display: flex; gap: 6px; align-items: center; }
.preview-controls .btn { min-width: 32px; text-align: center; }

.preview-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  min-height: 200px;
}
.preview-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
}
.preview-content video {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
}

.preview-info {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.audio-preview {
  text-align: center;
  padding: 30px;
}
.audio-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.audio-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
}
.preview-content audio { width: 100%; max-width: 500px; }

.text-preview {
  width: 100%;
  max-height: 70vh;
  overflow: auto;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  color: var(--text-primary);
}

.preview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.preview-error {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 768px) {
  .preview-modal { width: 98vw; max-height: 95vh; border-radius: 12px; }
  .preview-header { padding: 10px 12px; }
  .preview-title { max-width: 40%; font-size: 12px; }
  .preview-content { padding: 8px; }
}
