/* Storyling Admin Dashboard Styles */
/* Cohérent avec le reste du site — dark theme, Playfair Display / DM Sans */

:root {
  --bg: #0b0b16;
  --surface: #14141f;
  --surface2: #1e1e2e;
  --border: #2a2a40;
  --accent: #7c6af7;
  --accent-hover: #6b59e8;
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --radius: 10px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1rem;
  flex-shrink: 0;
}

.sidebar-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 2.5rem;
  padding: 0 0.5rem;
  text-decoration: none;
}

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

.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; }

.sidebar-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem 0.25rem;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--text);
  margin: 0 0 2rem;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

/* Section panels */
.section-panel {
  display: none;
}
.section-panel.active { display: block; }

/* Character cards */
.character-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.character-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.character-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--text);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-open { background: rgba(39,174,96,0.2); color: var(--success); }
.badge-closed { background: rgba(136,136,170,0.2); color: var(--text-muted); }

.vote-rows { display: flex; flex-direction: column; gap: 0.5rem; }

.vote-row { display: flex; align-items: center; gap: 0.75rem; }

.vote-key {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  width: 2rem;
  text-align: center;
}

.vote-bar-wrap {
  flex: 1;
  background: var(--surface2);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.vote-bar {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.vote-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 3rem;
  text-align: right;
}

.total-votes {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn {
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-success { background: rgba(39,174,96,0.15); color: var(--success); border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: rgba(39,174,96,0.3); }

.btn-danger { background: rgba(231,76,60,0.15); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(231,76,60,0.3); }

.btn-warning { background: rgba(243,156,18,0.15); color: var(--warning); border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background: rgba(243,156,18,0.3); }

/* Top characters */
.top-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.top-table th, .top-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.top-table th { color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.top-table td { color: var(--text); }
.top-table tr:last-child td { border-bottom: none; }

/* Loading / empty */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

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

.error-msg {
  background: rgba(231,76,60,0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-size: 0.85rem;
  margin: 1rem 0;
}