/* EnuguWest Political Campaign & Election Analytics Platform Stylesheet */
:root {
  --ew-primary: #047857;
  --ew-primary-dark: #064e3b;
  --ew-primary-light: #10b981;
  --ew-primary-subtle: #ecfdf5;
  --ew-gold: #f59e0b;
  --ew-gold-dark: #b45309;
  --ew-gold-light: #fef3c7;
  --ew-accent: #3b82f6;
  --ew-danger: #ef4444;
  --ew-warning: #f97316;
  --ew-success: #10b981;
  --ew-dark: #0f172a;
  --ew-slate: #1e293b;
  --ew-muted: #64748b;
  --ew-border: #e2e8f0;
  --ew-bg: #f8fafc;
  --ew-card-bg: #ffffff;
  --ew-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --ew-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --ew-radius: 12px;
  --ew-radius-sm: 8px;
}

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

/* Navbar */
.ew-navbar {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 0.6rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  height: 44px;
  width: auto;
}

.nav-link.ew-nav-item {
  font-weight: 600;
  color: #475569;
  padding: 0.6rem 0.9rem;
  border-radius: var(--ew-radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92rem;
}

.nav-link.ew-nav-item:hover {
  color: var(--ew-primary);
  background-color: var(--ew-primary-subtle);
}

.nav-link.ew-nav-item.active {
  color: #ffffff;
  background-color: var(--ew-primary);
  box-shadow: 0 2px 4px rgba(4, 120, 87, 0.25);
}

/* Header Live Status Strip */
.election-ticker-strip {
  background: linear-gradient(90deg, #064e3b 0%, #065f46 60%, #047857 100%);
  color: #ffffff;
  padding: 0.45rem 1.25rem;
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticker-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 0 rgba(52, 211, 153, 0.4);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* Metric Cards */
.ew-stat-card {
  background: #ffffff;
  border-radius: var(--ew-radius);
  border: 1px solid var(--ew-border);
  padding: 1.25rem;
  box-shadow: var(--ew-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.ew-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ew-shadow-lg);
}

.ew-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--ew-primary);
}

.ew-stat-card.gold::before { background-color: var(--ew-gold); }
.ew-stat-card.blue::before { background-color: var(--ew-accent); }
.ew-stat-card.danger::before { background-color: var(--ew-danger); }
.ew-stat-card.purple::before { background-color: #8b5cf6; }

.stat-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background-color: var(--ew-primary-subtle);
  color: var(--ew-primary);
}

.stat-icon-bubble.gold {
  background-color: var(--ew-gold-light);
  color: var(--ew-gold-dark);
}

.stat-icon-bubble.blue {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.stat-icon-bubble.purple {
  background-color: #ede9fe;
  color: #6d28d9;
}

/* Custom Panels */
.ew-panel {
  background: #ffffff;
  border-radius: var(--ew-radius);
  border: 1px solid var(--ew-border);
  box-shadow: var(--ew-shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.ew-panel-header {
  padding: 1rem 1.25rem;
  background-color: #ffffff;
  border-bottom: 1px solid var(--ew-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ew-panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ew-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ew-panel-body {
  padding: 1.25rem;
}

/* AutocallAI Simulator Widget */
.call-simulator-box {
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: var(--ew-radius);
  padding: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4);
}

.audio-waveform-container {
  height: 55px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  overflow: hidden;
}

.wave-bar {
  width: 4px;
  background-color: #10b981;
  border-radius: 2px;
  height: 10px;
  transition: height 0.15s ease;
}

.wave-bar.active {
  animation: waveAnim 0.7s infinite alternate ease-in-out;
}

@keyframes waveAnim {
  0% { height: 8px; }
  100% { height: 45px; }
}

.transcript-feed {
  max-height: 280px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
}

.chat-bubble {
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
  max-width: 85%;
}

.chat-bubble.agent {
  background: #065f46;
  color: #ecfdf5;
  margin-right: auto;
  border-bottom-left-radius: 2px;
}

.chat-bubble.voter {
  background: #334155;
  color: #f1f5f9;
  margin-left: auto;
  border-bottom-right-radius: 2px;
}

/* Map Container */
#enuguWestMap {
  height: 520px;
  width: 100%;
  border-radius: var(--ew-radius-sm);
  z-index: 1;
}

/* Polling Unit Badges & Chips */
.badge-pu {
  background-color: #e2e8f0;
  color: #334155;
  font-family: monospace;
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

/* Table styling */
.ew-table {
  width: 100%;
  margin-bottom: 0;
}

.ew-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1rem;
}

.ew-table td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.88rem;
}

.ew-table tr:hover td {
  background-color: #f8fafc;
}

/* Candidate Card */
.candidate-hero-banner {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #0f766e 100%);
  color: #ffffff;
  border-radius: var(--ew-radius);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--ew-shadow-lg);
}

.candidate-hero-banner::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.2) 0%, rgba(251, 191, 36, 0) 70%);
}

/* Range slider custom */
.custom-range::-webkit-slider-thumb {
  background: var(--ew-primary);
}

/* IREV Form EC8A Thumbnail */
.ec8a-thumbnail {
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  max-width: 100%;
  box-shadow: var(--ew-shadow);
}

.ec8a-thumbnail:hover {
  transform: scale(1.02);
  border-color: var(--ew-primary);
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  #enuguWestMap {
    height: 380px;
  }
}

/* Data Provenance Info Tooltip Button */
.ew-info-btn {
  background: none;
  border: none;
  padding: 0 4px;
  color: #64748b;
  font-size: 0.85rem;
  cursor: pointer;
  vertical-align: middle;
  transition: color 0.15s ease, transform 0.15s ease;
}

.ew-info-btn:hover,
.ew-info-btn:focus {
  color: var(--ew-primary);
  transform: scale(1.15);
  outline: none;
}

.popover {
  max-width: 340px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
  border: 1px solid #cbd5e1;
}

.popover-header {
  background-color: #f8fafc;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

.popover-body {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #334155;
}

/* ==========================================
   Animated Card Menu System
   ========================================== */
.ew-card-menu-grid {
  margin-bottom: 1.5rem;
}

.ew-menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  text-decoration: none;
  color: var(--ew-dark);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: all 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.ew-menu-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--ew-primary), var(--ew-gold));
  transition: width 0.25s ease;
}

.ew-menu-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(4, 120, 87, 0.18);
  border-color: var(--ew-primary-light);
  color: var(--ew-dark);
}

.ew-menu-card:hover::after,
.ew-menu-card.active::after {
  width: 100%;
}

.ew-menu-card.active {
  background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
  border-color: #047857;
  color: #ffffff;
  box-shadow: 0 10px 22px -6px rgba(4, 120, 87, 0.42);
}

.ew-menu-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.ew-menu-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform 0.25s ease;
}

.ew-menu-card.active .ew-menu-icon-wrap {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fbbf24 !important;
}

.ew-menu-mini-logo {
  height: 22px;
  width: auto;
  opacity: 0.88;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.ew-menu-card:hover .ew-menu-mini-logo {
  transform: scale(1.08);
  opacity: 1;
}

.ew-menu-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.25;
  margin-bottom: 2px;
}

.ew-menu-card-sub {
  font-size: 0.74rem;
  color: #64748b;
  line-height: 1.2;
}

.ew-menu-card.active .ew-menu-card-sub {
  color: rgba(255, 255, 255, 0.78);
}

/* Keyframe Icon Animations */
@keyframes ewRing {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
}

@keyframes ewBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes ewPulseGlow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes ewOrbit {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes ewFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(4deg); }
}

.ew-menu-card:hover .anim-ring,
.ew-menu-card.active .anim-ring {
  animation: ewRing 1.1s ease-in-out infinite;
}

.ew-menu-card:hover .anim-bounce,
.ew-menu-card.active .anim-bounce {
  animation: ewBounce 1.1s ease-in-out infinite;
}

.ew-menu-card:hover .anim-pulse,
.ew-menu-card.active .anim-pulse {
  animation: ewPulseGlow 1.4s ease-in-out infinite;
}

.ew-menu-card:hover .anim-orbit,
.ew-menu-card.active .anim-orbit {
  animation: ewOrbit 6s linear infinite;
}

.ew-menu-card:hover .anim-float,
.ew-menu-card.active .anim-float {
  animation: ewFloat 1.8s ease-in-out infinite;
}
