/**
 * Election app bridge — maps legacy classes to SSU theme/admin.css
 * and adds voting-specific UI (ballot, live, candidates).
 */

:root {
  --uvs-primary: var(--ssu-blue, #0a2a66);
  --uvs-accent: var(--ssu-blue-light, #123a8a);
  --uvs-gold: var(--ssu-gold, #F2C318);
  --uvs-bg: var(--ssu-gray, #f4f6f9);
  --uvs-card: var(--ssu-surface, #fff);
  --uvs-text: var(--ssu-text, #1a1a1a);
  --uvs-muted: var(--ssu-muted-text, #64748b);
  --uvs-border: var(--ssu-border-muted, #e2e8f0);
}

[data-theme="dark"] {
  --ssu-body-bg: #0b1220;
  --ssu-surface: #111827;
  --ssu-surface-muted: #1e293b;
  --ssu-gray: #0f172a;
  --ssu-text: #e2e8f0;
  --ssu-muted-text: #94a3b8;
  --ssu-border-muted: #334155;
  --ssu-heading: #e2e8f0;
  --admin-main-bg: #0b1220;
  --admin-surface: #111827;
  --admin-surface-muted: #1e293b;
  --admin-border: #334155;
  --admin-text: #e2e8f0;
  --admin-text-muted: #94a3b8;
  --admin-text-subtle: #64748b;
  --admin-heading: #e2e8f0;
  --admin-navbar-bg: rgba(17, 24, 39, 0.92);
}

.admin-body {
  margin: 0;
  background: var(--admin-main-bg, var(--ssu-body-bg));
}

.admin-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.12);
  display: block !important;
}

.admin-sidebar-brand-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.admin-sidebar-brand-top .admin-title {
  flex: 1;
  min-width: 0;
}

.admin-logo-fallback {
  width: 40px;
  height: 40px;
  border-radius: 0.45rem;
  background: rgba(242, 195, 24, 0.18);
  color: var(--ssu-gold, #F2C318);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Font Awesome icons in admin sidebar (theme targets .bi) */
.admin-sidebar-menu-item i,
.admin-sidebar-group-btn i,
.admin-sidebar-sub-link i,
.admin-sidebar-footer .admin-sidebar-menu-item i,
.admin-user-pill i {
  width: 1.1rem;
  font-size: 0.95rem;
  flex-shrink: 0;
  text-align: center;
  opacity: 0.95;
}

.admin-sidebar-menu-item,
.admin-sidebar-group-btn,
.admin-sidebar-sub-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Legacy page components → SSU look */
.stat-card {
  background: var(--admin-surface, #fff);
  border: 1px solid var(--admin-border, var(--ssu-border-muted));
  border-radius: 0.85rem;
  padding: 1.1rem 1.25rem;
  height: 100%;
  box-shadow: var(--admin-card-shadow, var(--ssu-shadow-sm));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ssu-shadow-md);
}
.stat-card .label {
  color: var(--admin-text-muted, var(--ssu-muted-text));
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 0.2rem;
  color: var(--admin-heading, var(--ssu-heading));
  font-variant-numeric: tabular-nums;
}
.stat-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 42, 102, 0.1);
  color: var(--ssu-blue);
}

.card-uvs {
  background: var(--admin-surface, #fff);
  border: 1px solid var(--admin-border, var(--ssu-border-muted));
  border-radius: 0.85rem;
  box-shadow: var(--admin-card-shadow, var(--ssu-shadow-sm));
  overflow: hidden;
}
.card-uvs .card-header {
  background: transparent;
  border-bottom: 1px solid var(--admin-border, var(--ssu-border-muted));
  font-weight: 700;
  color: var(--admin-heading, var(--ssu-heading));
  padding: 0.95rem 1.15rem;
}

.btn-primary {
  --bs-btn-bg: var(--ssu-blue);
  --bs-btn-border-color: var(--ssu-blue);
  --bs-btn-hover-bg: var(--ssu-blue-light);
  --bs-btn-hover-border-color: var(--ssu-blue-light);
  --bs-btn-active-bg: var(--ssu-blue-light);
  --bs-btn-active-border-color: var(--ssu-blue-light);
}

.btn-warning {
  --bs-btn-bg: var(--ssu-gold);
  --bs-btn-border-color: var(--ssu-gold);
  --bs-btn-color: #0a2a66;
  --bs-btn-hover-bg: #e0b410;
  --bs-btn-hover-border-color: #e0b410;
  --bs-btn-hover-color: #0a2a66;
}

.table {
  --bs-table-bg: transparent;
  color: var(--admin-text, var(--ssu-text));
}
.form-control,
.form-select {
  background: var(--admin-surface, #fff);
  color: var(--admin-text, var(--ssu-text));
  border-color: var(--admin-border, var(--ssu-border-muted));
  border-radius: 0.55rem;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--ssu-blue);
  box-shadow: 0 0 0 0.2rem rgba(10, 42, 102, 0.15);
}

/* Ballot / candidates */
.candidate-card {
  border: 2px solid var(--admin-border, var(--ssu-border-muted));
  border-radius: 0.9rem;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  background: var(--admin-surface, #fff);
  height: 100%;
  display: block;
}
.candidate-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ssu-shadow-md);
  border-color: rgba(10, 42, 102, 0.35);
}
.candidate-card.selected,
label.candidate-card:has(input:checked) {
  border-color: var(--ssu-blue);
  box-shadow: 0 0 0 3px rgba(10, 42, 102, 0.18);
  background: rgba(10, 42, 102, 0.03);
}
.candidate-photo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--ssu-gray);
  border: 3px solid rgba(10, 42, 102, 0.08);
}

/* Live widgets */
.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 0.35rem;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: livePulse 1.5s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.live-hero {
  border-radius: 1rem;
  overflow: hidden;
  background:
    radial-gradient(ellipse at top right, rgba(242, 195, 24, 0.28), transparent 50%),
    linear-gradient(135deg, #0a2a66 0%, #123a8a 55%, #0d4aa8 100%);
  box-shadow: var(--ssu-shadow-md);
}
.live-hero-inner { padding: 1.5rem 1.5rem 1.35rem; }
.live-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #bbf7d0;
  background: rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}
.live-mega-count { text-align: center; }
.live-mega-number {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  color: #fff;
  letter-spacing: -0.03em;
  transition: transform 0.25s ease;
}
.live-mega-number.live-pop { transform: scale(1.06); }
.live-mega-label {
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  margin-top: 0.35rem;
}
.live-progress {
  height: 12px;
  background: rgba(15, 23, 42, 0.25);
  border-radius: 999px;
  overflow: hidden;
}
.live-progress .progress-bar {
  background: linear-gradient(90deg, var(--ssu-gold), #4ade80);
  transition: width 0.6s ease;
}
.live-pulse-badge { animation: liveBlink 1.2s ease-in-out infinite; }
@keyframes liveBlink { 50% { opacity: 0.55; } }
.live-stat .value { font-variant-numeric: tabular-nums; }

/* Auth pages fallback (when landing.css not loaded) */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at top left, rgba(242, 195, 24, 0.2), transparent 45%),
    linear-gradient(160deg, #0a2a66 0%, #123a8a 55%, #0c4a6e 100%);
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

@media (max-width: 767.98px) {
  .admin-main-content {
    padding: 1rem 0.9rem 2rem;
  }
  .stat-card .value {
    font-size: 1.4rem;
  }
}

@media print {
  .admin-sidebar-col,
  .admin-main-navbar,
  .admin-sidebar-backdrop,
  .no-print { display: none !important; }
  .admin-main { margin-left: 0 !important; width: 100% !important; }
}
