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

:root {
  --bg: #0f1923;
  --bg2: #1a2634;
  --bg3: #243447;
  --accent: #e53935;
  --accent-hover: #c62828;
  --text: #e0e0e0;
  --text2: #90a4ae;
  --border: #2c3e50;
  --success: #43a047;
  --danger: #e53935;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--bg2);
  padding: 2rem;
  border-radius: 12px;
  width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.login-box h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--accent);
  font-size: 1.5rem;
}

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--bg2);
  padding: 1rem 0;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.sidebar h2 {
  padding: 0 1rem 1rem;
  font-size: 1.1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.sidebar a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--text2);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.sidebar a:hover, .sidebar a.active {
  background: var(--bg3);
  color: var(--text);
}
.main { flex: 1; padding: 1.5rem; overflow-x: auto; }

/* Components */
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
textarea { min-height: 80px; resize: vertical; }
label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text2);
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  color: #fff;
  text-decoration: none;
}
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn + .btn { margin-left: 0.5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
th { color: var(--text2); font-weight: 600; }

.card {
  background: var(--bg2);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg2);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}
.stat-card .num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-card .lbl {
  color: var(--text2);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--success);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 999;
  animation: fadeIn 0.3s;
}
.toast.error { background: var(--danger); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; } }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg2);
  border-radius: 12px;
  padding: 1.5rem;
  width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal h3 { margin-bottom: 1rem; }
.modal-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-admin { background: var(--accent); }
.badge-moderator { background: #f57c00; }
.badge-user { background: var(--bg3); }

.poster-thumb {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.header-bar h2 { font-size: 1.25rem; }

.user-info {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text2);
  margin-top: auto;
}
.sidebar-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.sidebar-nav { flex: 1; }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

/* Sync stats bar */
.sync-stats-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.sync-stat {
  background: var(--bg2);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: center;
  min-width: 100px;
}
.sync-stat .num {
  font-size: 1.5rem;
  font-weight: 700;
}
.sync-stat .lbl {
  font-size: 0.75rem;
  color: var(--text2);
}
.sync-stat.pending .num { color: #78909c; }
.sync-stat.downloading .num { color: #2196f3; }
.sync-stat.uploading .num { color: #ff9800; }
.sync-stat.completed .num { color: var(--success); }
.sync-stat.failed .num { color: var(--danger); }
.sync-stat.total .num { color: var(--text); }

/* Progress bar */
.progress-bar {
  width: 80px;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
