/* WMF Voting Platform v5.1
 * Unified single CSS file (no code changes required)
 * Supports:
 * - Dark (default), Light, WMF Blue themes via html[data-theme]
 * - Login, dashboards, secretary, organizer, judge, public
 */

/* ========== THEME VARIABLES ========== */
:root {
  --bg: #020617;
  --bg-card: rgba(15,23,42,0.92);
  --border-soft: rgba(148,163,184,0.5);
  --accent: #4f46e5;
  --accent2: #ec4899;
  --text: #e5e7eb;
  --muted: #9ca3af;
}

/* Light theme */
html[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-card: #ffffff;
  --border-soft: #d4d4d8;
  --accent: #2563eb;
  --accent2: #7c3aed;
  --text: #0f172a;
  --muted: #6b7280;
}

/* WMF Blue theme */
html[data-theme="wmfblue"] {
  --bg: #0b1120;
  --bg-card: #0f172a;
  --border-soft: rgba(148,163,184,0.5);
  --accent: #3b82f6;
  --accent2: #38bdf8;
  --text: #e5e7eb;
  --muted: #9ca3af;
}

/* ========== GLOBAL RESET ========== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #1d2144 0, var(--bg) 55%, #000 100%);
}

/* ========== HEADER ========== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: linear-gradient(to right, rgba(15,23,42,0.98), rgba(15,23,42,0.9));
  border-bottom: 1px solid rgba(148,163,184,0.25);
  backdrop-filter: blur(14px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 0 0, rgb(255 255 255), rgb(255 255 255));
  
}

.brand-logo_login {
  width: 168px;
  height: 168px;
  border-radius: 91px;
  border: 1px solid rgba(148,163,184,0.6);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 0 0, rgb(255 255 255), rgb(255 255 255));
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-fallback {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-email {
  font-size: 12px;
}

.user-role {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--accent2);
}

.top-nav a {
  margin-left: 10px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--accent2);
}

/* ========== MAIN LAYOUT ========== */
.app-main {
  max-width: 1600px;
  margin: 18px auto 32px;
  padding: 0 12px 24px;
}

.app-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
}

/* ========== SIDEBAR ========== */
.sidebar {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  padding: 14px;
}

.sidebar h2 {
  font-size: 14px;
  margin: 0 0 8px 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: 7px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-link:hover {
  border-color: rgba(148,163,184,0.4);
  color: var(--text);
}

.nav-link.active {
  background: radial-gradient(circle at 0 0, rgba(94,234,212,0.16), rgba(56,189,248,0.05));
  border-color: rgba(96,165,250,0.8);
  color: #e5e7eb;
}

/* ========== CONTENT / CARDS ========== */
.content-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  padding: 14px 16px;
}

.card-title {
  margin: 0 0 4px 0;
  font-size: 18px;
}

.card-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumbs {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent2);
}

/* ========== GRID STATS ========== */
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  border: 1px solid rgba(148,163,184,0.5);
}

.pill-green {
  border-color: rgba(34,197,94,0.6);
  color: #bbf7d0;
}

.pill-amber {
  border-color: rgba(245,158,11,0.7);
  color: #fed7aa;
}

.stat-link {
  font-size: 12px;
  color: var(--accent2);
  text-decoration: none;
}

.stat-link:hover {
  text-decoration: underline;
}

/* ========== ALERTS ========== */
.alert-error,
.alert-success {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.alert-error {
  border: 1px solid rgba(248,113,113,0.7);
  background: rgba(248,113,113,0.08);
}

.alert-success {
  border: 1px solid rgba(52,211,153,0.7);
  background: rgba(52,211,153,0.08);
}

/* ========== FORMS ========== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: rgba(15,23,42,0.9);
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.5);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
}

textarea {
  border-radius: 12px;
  min-height: 70px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent2);
}

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  background: linear-gradient(to right, var(--accent), var(--accent2));
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15,23,42,0.8);
  text-decoration: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  padding: 7px 14px;
  font-size: 12px;
  background: rgba(15,23,42,0.9);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.btn-primary:hover,
.btn-secondary:hover {
  filter: brightness(1.07);
}

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th, td {
  border: 1px solid var(--border-soft);
  padding: 8px 10px;
  font-size: 13px;
}

th {
  background: rgba(15,23,42,0.85);
}

/* ========== LOGIN PAGE ========== */
.login-page {
  max-width: 420px;
  margin: 60px auto;
  text-align: center;
  background: radial-gradient(circle at 10% 0, rgba(94,234,212,0.12), rgba(15,23,42,0.96));
  border-radius: 26px;
  border: 1px solid rgba(129,140,248,0.7);
  box-shadow: 0 20px 50px rgba(15,23,42,0.9);
  padding: 20px 18px 22px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.login-logo-circle {
  width: 80px;
  height: 80px;
  border-radius: 999px;
  border: 2px solid rgba(148,163,184,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  background: radial-gradient(circle at 0 0, rgba(94,234,212,0.4), rgba(15,23,42,1));
}

.login-title {
  font-size: 18px;
  font-weight: 600;
}

.login-subtitle {
  font-size: 12px;
  color: var(--muted);
}

/* ========== FOOTER ========== */
.app-footer {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: var(--muted);
}

.footer-inner {
  opacity: 0.75;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    order: 2;
  }
}

@media (max-width: 640px) {
  .app-main {
    margin-top: 10px;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .header-right {
    align-self: stretch;
    justify-content: space-between;
  }
}
