@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Default Theme (Light Modern Slate) */
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --accent-color: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.1);
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(15, 23, 42, 0.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --success: #10b981;
  --danger: #ef4444;
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains+Mono', monospace;
}

/* Crimson/Burgundy Theme (Ketua Pelajar - Merah) */
.theme-merah {
  --bg-gradient: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  --accent-color: #e11d48;
  --accent-glow: rgba(225, 29, 72, 0.1);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(225, 29, 72, 0.12);
}

/* Electric Blue/Indigo Theme (Ketua Bahasa - Biru) */
.theme-biru {
  --bg-gradient: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  --accent-color: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.1);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
}

body {
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background 0.8s ease;
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.06);
  border-radius: 1.5rem; /* rounded-3xl equivalent */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header & Nav */
header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-color);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: all 0.5s ease;
}

.session-info {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.03);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Grid & Layouts */
.container {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Screen state blocks */
.screen-state {
  display: none;
  animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.screen-state.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Standby Screen */
.standby-illustration {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  animation: pulse 2.5s infinite ease-in-out;
  opacity: 0;
}

.pulse-ring:nth-child(2) {
  animation-delay: 1.25s;
}

.standby-icon {
  font-size: 2.5rem;
  color: var(--accent-color);
  z-index: 2;
}

h1.title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  line-height: 1.1;
}

p.subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 500px;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Cards & Candidates list */
.candidates-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 900px;
  margin: 2rem auto;
}

@media (min-width: 640px) {
  .candidates-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.candidate-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  padding: 2rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 2rem;
}

.candidate-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-color);
  box-shadow: 0 12px 40px 0 var(--accent-glow);
}

.candidate-card:active {
  transform: translateY(-2px) scale(0.98);
}

.candidate-card.selected {
  border-color: var(--accent-color);
  background: var(--accent-glow);
  box-shadow: 0 12px 40px 0 var(--accent-glow);
  transform: translateY(-6px);
}

.candidate-left-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px;
  flex-shrink: 0;
}

.candidate-right-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-grow: 1;
}

.candidate-info-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.candidate-photo-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #f1f5f9;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.candidate-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.candidate-placeholder {
  font-size: 3.5rem;
  color: var(--text-muted);
}

.candidate-number-text {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-color);
  margin-top: 0.35rem;
  display: inline-flex;
  align-items: center;
  background: var(--accent-glow);
  padding: 0.3rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--accent-color);
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.candidate-select-indicator {
  padding: 0.7rem 0;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.06);
  width: 100%;
  text-align: center;
  margin: 0;
}

.candidate-card:hover .candidate-select-indicator {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: rgba(255, 255, 255, 0.8);
}

.candidate-card.selected .candidate-select-indicator {
  background-color: var(--accent-color);
  color: #ffffff;
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.candidate-name {
  font-size: 1.65rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.2;
}

.candidate-slogan {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-style: italic;
  margin: 0;
}

/* Custom Buttons */
.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background-color: #1d4ed8; /* Darker blue */
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-2px);
}

.theme-merah .btn-primary:hover {
  background-color: #be123c;
}

.btn-primary:active {
  transform: translateY(0) scale(0.95);
}

.btn-secondary {
  background-color: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.95);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-2px);
}

/* Login Page Spec */
.login-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-color);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Success Animations */
.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem;
}

.check-icon {
  width: 80px;
  height: 80px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 4px solid var(--success);
}

.check-icon::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 12px;
  width: 45px;
  height: 22px;
  border-left: 4px solid var(--success);
  border-bottom: 4px solid var(--success);
  transform: rotate(-45deg);
  transform-origin: left top;
  animation: checkmark 0.6s ease;
}

/* Admin Dashboard layout */
.admin-layout {
  display: grid;
  grid-template-cols: 1fr;
  gap: 2rem;
  margin-top: 1rem;
}

@media (min-width: 1024px) {
  .admin-layout {
    grid-template-cols: 320px 1fr;
  }
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.admin-panel {
  padding: 1.5rem;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.5rem;
}

/* Voter List styling */
.voter-list {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 1rem;
}

.voter-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--card-border);
}

.voter-item:last-child {
  border-bottom: none;
}

.badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.badge-pending {
  background: rgba(234, 179, 8, 0.1);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.badge-voted {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Charts & Display */
.chart-container {
  position: relative;
  width: 100%;
  height: 350px;
  margin-top: 1.5rem;
}

.display-title-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.display-grid {
  display: grid;
  grid-template-cols: 1fr;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 1024px) {
  .display-grid {
    grid-template-cols: 1fr 1.2fr;
  }
}

.countdown-box {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.countdown-timer {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-color);
}



/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 0;
  }
  100% {
    transform: scale(0.95);
    opacity: 0;
  }
}

@keyframes checkmark {
  0% {
    height: 0;
    width: 0;
    opacity: 0;
  }
  40% {
    height: 0;
    width: 20px;
    opacity: 1;
  }
  100% {
    height: 22px;
    width: 45px;
    opacity: 1;
  }
}

/* Sleek Admin Dashboard Sidebar Redesign */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-gradient);
}

.sidebar-nav {
  width: 300px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.sidebar-header .brand-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-radius: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.sidebar-menu-item:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

.sidebar-menu-item.active {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-menu-item .menu-icon {
  font-size: 1.15rem;
}

.sidebar-footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  padding: 2.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}

.admin-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.admin-section.active {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Stat Card Grid for Dashboard Overview */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1.5rem;
  text-align: left;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 0.5rem;
  line-height: 1;
}

.stat-card .stat-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}
