/* 
 * PILKET RW 023 DESIGN SYSTEM
 * Inspired by Official Election Banner: Royal Blue, Deep Indigo, Gold Accent, Clean White
 */

:root {
  --primary: #103778;
  --primary-dark: #0a224e;
  --primary-light: #1e52ad;
  --secondary: #e6a117;
  --secondary-light: #ffd56b;
  --secondary-dark: #b87b08;
  --accent-maroon: #80102b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-gradient: linear-gradient(135deg, #0b1a30 0%, #102a54 50%, #153e7e 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f1f5f9;
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   HEADER & HERO BANNER
   ============================================================ */
.hero-header {
  background: var(--bg-gradient);
  color: #ffffff;
  padding: 2.5rem 1rem 3.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(10, 34, 78, 0.3);
}

.hero-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(230, 161, 23, 0.12) 0%, transparent 65%);
  pointer-events: none;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 2;
}

.logo-wrap {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 0 25px rgba(255, 213, 107, 0.45);
  margin-bottom: 1.25rem;
  border: 3px solid var(--secondary);
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-wrap:hover {
  transform: scale(1.06);
}

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

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.hero-subtitle {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--secondary-light);
  margin-bottom: 0.25rem;
}

.hero-period {
  font-size: 0.95rem;
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 1.5rem;
  letter-spacing: 0.5px;
}

.status-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.status-badge-wrap.locked {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #10b981;
  animation: pulse 1.8s infinite;
}

.status-badge-wrap.locked .pulse-dot {
  background-color: #ef4444;
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Live Countdown Bar */
.live-indicator-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.btn-refresh-manual {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.btn-refresh-manual:hover {
  background: rgba(255, 255, 255, 0.25);
  color: var(--secondary-light);
}

/* ============================================================
   MAIN CONTENT WRAPPER
   ============================================================ */
.main-wrapper {
  max-width: 1200px;
  margin: -1.75rem auto 3rem;
  padding: 0 1rem;
  position: relative;
  z-index: 3;
  width: 100%;
}

/* Announcement Banner */
.announcement-box {
  background: #ffffff;
  border-left: 5px solid var(--secondary);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}

.announcement-icon {
  font-size: 1.5rem;
  color: var(--secondary-dark);
}

.announcement-text {
  font-size: 0.95rem;
  color: #334155;
  font-weight: 500;
}

/* ============================================================
   STATISTICS SUMMARY GRID
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 4px solid var(--primary-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.15);
}

.stat-card.stat-sah { border-top-color: var(--success); }
.stat-card.stat-tidaksah { border-top-color: var(--danger); }
.stat-card.stat-partisipasi { border-top-color: var(--secondary); }
.stat-card.stat-dpt { border-top-color: var(--primary); }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-dpt .stat-icon { background: #eff6ff; color: var(--primary); }
.stat-sah .stat-icon { background: #ecfdf5; color: var(--success); }
.stat-tidaksah .stat-icon { background: #fef2f2; color: var(--danger); }
.stat-partisipasi .stat-icon { background: #fffbeb; color: var(--secondary-dark); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   CANDIDATES CARDS (GRID OF 4)
   ============================================================ */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.candidate-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  border: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.candidate-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.candidate-card.is-leader {
  border-color: var(--secondary);
  box-shadow: 0 10px 25px -5px rgba(230, 161, 23, 0.35);
}

.leader-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--secondary) 0%, #d97706 100%);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.candidate-photo-wrap {
  width: 100%;
  height: 240px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f1f5f9 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid #e2e8f0;
}

.candidate-photo {
  height: 98%;
  width: auto;
  max-width: 95%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.candidate-card:hover .candidate-photo {
  transform: scale(1.05);
}

.candidate-number-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  background: var(--primary-dark);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--secondary);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.candidate-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.candidate-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

/* Vote Metrics */
.vote-metric-box {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1rem;
  border: 1px solid #e2e8f0;
}

.vote-metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}

.vote-count {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
}

.vote-percentage {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--secondary-dark);
}

.vote-progress-bg {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.vote-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--secondary) 100%);
  border-radius: 9999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Vision & Mission Dropdown */
.vision-collapse {
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px dashed #cbd5e1;
  padding-top: 0.75rem;
  margin-top: auto;
}

.vision-collapse strong {
  color: var(--text-dark);
}

/* ============================================================
   CHART SECTION
   ============================================================ */
.chart-section {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 2.5rem;
}

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

.chart-toggle-group {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
}

.btn-chart-toggle {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-chart-toggle.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-canvas-container {
  position: relative;
  height: 340px;
  width: 100%;
}

/* ============================================================
   EVIDENCE & TRANSPARENCY GALLERY (Plano C1)
   ============================================================ */
.gallery-section {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 2.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.gallery-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  background: #f8fafc;
}

.gallery-item:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-light);
}

.gallery-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  padding: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.empty-gallery {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ============================================================
   MODAL LIGHTBOX
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.modal-img-large {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* ============================================================
   RESPONSIVE DESIGN (Mobile Friendly)
   ============================================================ */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.35rem;
  }
  .hero-subtitle {
    font-size: 0.95rem;
  }
  .logo-wrap {
    width: 70px;
    height: 70px;
  }
  .candidates-grid {
    grid-template-columns: 1fr;
  }
  .stat-value {
    font-size: 1.4rem;
  }
  .chart-canvas-container {
    height: 280px;
  }
  .tps-table th, .tps-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

/* ============================================================
   DATA SUARA PER TPS STYLES
   ============================================================ */
.tps-section {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
  margin-bottom: 2.5rem;
}

.tps-progress-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tps-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.tps-progress-bar-wrap {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.tps-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 9999px;
  transition: width 0.6s ease;
}

.tps-table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
}

.tps-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.tps-table th {
  background: #f1f5f9;
  color: var(--primary-dark);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}

.tps-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.tps-table tbody tr:hover {
  background: #f8fafc;
}

.tps-table tfoot td {
  background: #f1f5f9;
  font-weight: 800;
  border-top: 2px solid #cbd5e1;
  color: var(--primary-dark);
}

.badge-status-tps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-status-tps.selesai {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-status-tps.proses {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}

.badge-status-tps.belum {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.tps-lead-calon {
  font-weight: 800;
  color: var(--primary);
  background: #eff6ff;
  padding: 2px 6px;
  border-radius: 4px;
}



/* ============================================================
   RUNNING MARQUEE BANNER (BIGGER & PROMINENT - PILKET RW 023)
   ============================================================ */
.running-banner-bar {
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #050c1a 0%, #0a1b38 35%, #0f2752 50%, #0a1b38 65%, #050c1a 100%);
  border-top: 2px solid rgba(230, 161, 23, 0.7);
  border-bottom: 2px solid rgba(56, 189, 248, 0.6);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  height: 52px;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #e6a117 0%, #b87b08 100%);
  color: #0b1a30;
  padding: 0 1.25rem;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
  height: 100%;
  box-shadow: 4px 0 14px rgba(0, 0, 0, 0.4);
  border-right: 1.5px solid rgba(255, 255, 255, 0.35);
  z-index: 2;
}

.banner-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
  animation: bannerPulse 1.4s infinite ease-in-out;
}

@keyframes bannerPulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 16px #ffffff; }
  100% { transform: scale(0.85); opacity: 0.8; }
}

.banner-marquee-container {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  mask-image: linear-gradient(90deg, transparent 0%, black 2%, black 98%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 2%, black 98%, transparent 100%);
}

.banner-marquee-track {
  display: inline-flex;
  align-items: center;
  will-change: transform;
  animation: bannerMarqueeScroll 28s linear infinite;
}

.banner-marquee-track:hover {
  animation-play-state: paused;
}

.banner-marquee-text,
.banner-marquee-text-dup {
  display: inline-block;
  font-size: 1.15rem; /* Noticeably BIGGER than port 7500 (14px vs 18.5px) */
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.035em;
  padding: 0 2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 12px rgba(56, 189, 248, 0.35);
}

.banner-marquee-separator {
  color: #ffd56b;
  font-size: 1.25rem;
  margin: 0 0.5rem;
  opacity: 0.95;
  text-shadow: 0 0 10px #e6a117;
}

@keyframes bannerMarqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (max-width: 640px) {
  .running-banner-bar {
    height: 46px;
  }
  .banner-badge {
    padding: 0 0.85rem;
    font-size: 0.75rem;
    gap: 6px;
  }
  .banner-pulse-dot {
    width: 8px;
    height: 8px;
  }
  .banner-marquee-text,
  .banner-marquee-text-dup {
    font-size: 1rem;
    padding: 0 1.25rem;
  }
}
