/* ============================================================
   KPU UPH DIGITAL VOTING — DESIGN SYSTEM
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Sora:wght@600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --success:       #16a34a;
  --success-light: #dcfce7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --warning:       #d97706;
  --warning-light: #fef3c7;

  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  --sidebar-bg:    #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text:  #94a3b8;
  --sidebar-active-bg: #2563eb;
  --sidebar-active-text: #ffffff;

  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     14px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow:        0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 20px rgba(0,0,0,0.10);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  background-image: url('resources/background.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   VOTE MANDIRI & GLASSMORPHISM ADDITIONS
   ============================================================ */

.glass-container {
    background: rgba(255, 255, 255, 0.09) !important; 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    color: white;
}

/* Penyesuaian Input untuk Background Gelap */
.glass-container input {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

.glass-container input::placeholder {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Voter Badge */
.voter-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.voter-label { 
    font-size: 11px; 
    text-transform: uppercase; 
    opacity: 0.8; 
    display: block; 
}

.token-box { 
    background: rgba(0, 0, 0, 0.3); 
    padding: 5px 12px; 
    border-radius: 5px; 
    font-family: monospace; 
    font-weight: bold;
}

/* Area Scroll Internal */
.scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.scroll-area::-webkit-scrollbar { width: 6px; }
.scroll-area::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.2); 
    border-radius: 4px; 
}

/* Candidate Card Dark Mode Override */
.candidate-card-glass {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

.candidate-card-glass.selected {
    border-color: #4ade80 !important; 
    background: rgba(22, 163, 74, 0.2) !important;
}

/* ============================================================
   AUTH PAGES — Login / Register
   ============================================================ */

.container { 
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  
  padding: 44px 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 420px;
  text-align: center;
  color: white; /* Memaksa teks dasar menjadi putih */
}

.container h1 {
  /* var(--primary) terlalu gelap untuk background transparan, gunakan biru muda */
  color: #93c5fd; 
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.container h2, 
.container h3 {
  color: white;
}

.container p,
.container a {
  color: rgba(255, 255, 255, 0.7);
}

.container a:hover {
  color: white;
}

.container hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin: 22px 0;
}

.container input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
}

.container input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.container input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.15);
}

/* ---- Inputs ---- */
input {
  width: 100%;
  padding: 11px 14px;
  margin: 7px 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder { color: var(--text-light); }

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ---- Buttons ---- */
button {
  width: 100%;
  padding: 12px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

/* ---- Action Buttons Override ---- */
.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 13px 20px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    letter-spacing: 0.5px;
}

.btn-success:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.3);
}

.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px 20px;
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
}

button:active { transform: scale(0.98); }

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#loginForm button {
  background: var(--primary);
  color: white;
  margin-top: 6px;
  letter-spacing: 0.03em;
}

#loginForm button:hover { background: var(--primary-dark); }

#registerForm button {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

#registerForm button:hover {
  background: var(--primary);
  color: white;
}

.btn-register {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #475569;
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin-left: 5px;
  transition: background 0.2s;
}

.btn-register:hover { background: #334155; }

.btn-secondary {
  background: #059669;
  color: white;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.btn-secondary:hover { background: #047857; }

/* ---- Links ---- */
a { text-decoration: none; color: var(--primary); font-size: 14px; }
a:hover { text-decoration: underline; }

/* ---- Error / Feedback ---- */
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ============================================================
   ADMIN / DASHBOARD LAYOUT
   ============================================================ */

.dashboard-container {
  background: rgba(255, 255, 255, 0.97);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 92%;
  max-width: 1280px;
  height: 88vh;
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.6);
}

/* ---- Sidebar (Terang) ---- */
.sidebar {
  background: var(--surface); /* Mengubah latar belakang menjadi putih/terang */
  border-right: 1px solid var(--border); /* Menambahkan batas kanan agar terpisah dari konten */
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border); /* Menyesuaikan warna batas bawah */
  color: var(--text); /* Warna teks brand utama */
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand svg {
  color: var(--primary); /* Memberikan warna primary pada icon brand */
}

.sidebar ul {
  list-style: none;
  padding: 10px 10px;
  margin: 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar li { margin-bottom: 2px; }

.sidebar a {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  padding: 9px 11px;
  color: var(--text-muted); /* Warna teks default menjadi abu-abu */
  border-radius: 7px;
  transition: background 0.15s, color 0.15s;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none !important;
  border: none;
  background: transparent;
  width: 100%;
  box-sizing: border-box;
}

/* SVG icons inside sidebar links */
.sidebar a svg,
.sidebar a > svg {
  width: 15px !important;
  height: 15px !important;
  flex-shrink: 0;
  opacity: 0.7;
  vertical-align: middle;
}

.sidebar a:hover {
  background: var(--bg); /* Warna hover sedikit lebih gelap dari surface */
  color: var(--text); /* Teks menjadi lebih gelap saat hover */
  text-decoration: none !important;
  transform: none;
  box-shadow: none;
}

.sidebar a:hover svg { opacity: 0.9; }

.sidebar a.active {
  background: var(--primary-light); /* Latar belakang biru sangat muda */
  color: var(--primary-dark); /* Teks biru gelap */
  font-weight: 600;
  text-decoration: none !important;
  transform: none;
  box-shadow: none; /* Menghapus bayangan agar terlihat rata */
}

.sidebar a.active svg { 
    opacity: 1; 
    color: var(--primary); /* Ikon biru jelas pada active state */
}

/* Sidebar bottom area */
.sidebar-footer {
  padding: 10px 10px 14px;
  border-top: 1px solid var(--border); /* Menyesuaikan batas atas */
}
/* ---- Main Content ---- */
.main-content {
  flex: 1;
  padding: 32px 36px;
  overflow-y: auto;
  background: var(--bg);
}

/* ---- Header Bar ---- */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.header-bar h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-bar h2 i {
  color: var(--primary);
  width: 20px;
  height: 20px;
}

/* ---- Logout Button (sidebar) ---- */
.logout-btn {
  width: 100%;
  padding: 9px 12px;
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(220,38,38,0.18);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
  margin-top: 0;
  font-family: 'DM Sans', sans-serif;
}

.logout-btn svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: rgba(220,38,38,0.24);
  color: #f87171;
  box-shadow: none;
  transform: none;
}

/* ---- Stat Cards ---- */
.top-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  padding: 22px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card h4 {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-number {
  font-family: 'Sora', sans-serif;
  font-size: 2.4em;
  font-weight: 700;
  color: var(--primary);
  margin: 10px 0 4px;
  line-height: 1;
}

.stat-card small { color: var(--text-light); font-size: 12px; }

/* ---- Distribution Grid ---- */
.distribution-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.distribution-grid .stat-card {
  justify-content: flex-start;
  padding-top: 22px;
  text-align: left;
}

.distribution-grid .stat-card h4 {
  text-align: left;
  margin-bottom: 16px;
}

/* ---- Tutorial Section ---- */
.tutorial-section {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  border-left: 4px solid var(--success);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  margin-top: 24px;
}

.tutorial-step {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}

.tutorial-step:last-child { border-bottom: none; margin-bottom: 0; }

/* ---- Prodi List (Progress Bars) ---- */
.prodi-list { display: flex; flex-direction: column; gap: 12px; }
.prodi-item { width: 100%; }

.prodi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 5px;
}

.prodi-name { font-weight: 600; color: var(--text); font-size: 13px; }
.prodi-stats { font-size: 12px; color: var(--text-muted); }

.progress-track {
  width: 100%;
  height: 7px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 10px;
  transition: width 0.6s ease-out;
}

/* ---- Status Badges ---- */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 8px;
}

.status-open { background: var(--success-light); color: var(--success); }
.status-closed { background: var(--danger-light); color: var(--danger); }

/* ---- Toggle Switch ---- */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 26px;
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* ---- Committee Panel (big menu buttons) ---- */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.big-btn {
  padding: 36px 20px;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.big-btn i {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

.big-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(37,99,235,0.25);
}

/* ---- Voting Page ---- */
.voting-container {
  max-width: 960px;
  margin: 40px auto;
  background: rgba(255,255,255,0.97);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
  position: relative;
}

.header-vote {
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.voting-container .logout-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: auto;
  padding: 7px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.intro-actions {
  margin: 44px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

.intro-actions > div {
  width: 100%;
}

.intro-actions {
  align-items: stretch;
}
/* ---- Candidate Grid ---- */
.candidates-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.candidate-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  width: 196px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
  border: 2px solid var(--border);
  text-align: left;
  display: flex;
  flex-direction: column;
}

.candidate-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #93c5fd;
}

.candidate-card.selected {
  border-color: var(--success);
  background: #f0fdf4;
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}

.candidate-img {
  width: 100%;
  height: 196px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.cand-info { padding: 12px; text-align: center; }

.cand-info h3 {
  margin: 0 0 5px 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
}

.cand-info p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Voting Button ---- */
.btn-primary {
  width: auto;
  background: #d97706;
  color: white;
  border: none;
  padding: 13px 36px;
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}

.btn-primary:hover { background: #b45309; }
.btn-primary:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--text);
  color: white;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s ease;
  z-index: 9999;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  box-shadow: var(--shadow-md);
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary); }

/* ---- Utility ---- */
.hidden { display: none !important; }

#eventTitleDisplay {
  font-family: 'Sora', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
  letter-spacing: -0.5px;
}

/* ---- TPS Selector ---- */
.tps-selector {
  margin: 18px 0;
  padding: 10px 14px;
  width: 100%;
  max-width: 300px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}

.tps-selector:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ---- Loading Text ---- */
.loading-text {
  color: var(--text-light);
  font-style: italic;
  margin-top: 18px;
  font-size: 14px;
}

/* ---- Admin Action Buttons (inline) ---- */
.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ---- Chart Container ---- */
.chart-container {
  width: 100%;
  height: 180px;
  position: relative;
  display: flex;
  justify-content: center;
}

/* ---- Print Styles ---- */
#print-area { display: none; }

@media print {
  @page { size: A4 portrait; margin: 2cm 1cm; }
  body { background: white !important; padding: 0 !important; margin: 0 !important; }
  .dashboard-container { display: none !important; }
  #print-area {
    display: block !important;
    color: black !important;
    padding: 1700px 20px 20px 20px;
    width: 100%;
    background: white !important;
    box-sizing: border-box;
  }
  .print-only { display: block !important; }
  table { width: 100%; border-collapse: collapse; margin-top: 20px; }
  th, td { border: 1px solid #333; padding: 10px; text-align: left; font-size: 12px; }
  th { background-color: #f2f2f2 !important; }
}
 
.candidate-card-glass h3 {
    color: white !important;
}

.candidate-card-glass p {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ---- Tombol Koreksi (Merah Outline Glass) ---- */
.btn-koreksi-red {
    background: rgba(220, 38, 38, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(220, 38, 38, 0.25);
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    width: auto !important;
    flex-shrink: 0;
}

.btn-koreksi-red:hover {
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.4);
    color: white;
}

/* ---- Disabled State untuk Tombol Success ---- */
.btn-success:disabled {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
}

/* ---- Fix Perataan Tombol ---- */
.btn-success {
    width: auto !important; /* Memaksa tombol tidak selebar container */
    min-width: 200px;
}

/* ---- Custom Modal Popup ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-title {
    color: #93c5fd;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* ============================================================
   DYNAMIC CONTAINER STATE (ANIMASI UKURAN KOTAK)
   ============================================================ */

.voting-container {
    max-width: 420px !important; /* Sempit saat fase login */
    transition: max-width 0.5s cubic-bezier(0.25, 1, 0.5, 1), padding 0.5s ease;
}

.voting-container.ballot-mode {
    max-width: 900px !important; /* Melebar saat fase pemilihan kandidat */
}

/* Memastikan form login mengambil ruang penuh di dalam container sempit */
.intro-actions {
    max-width: 100% !important; 
    padding: 0;
} 

/* ============================================================
   MOBILE ACCESS RESTRICTION
   ============================================================ */

/* Mobile gate — tersembunyi di desktop */
#mobile-gate {
    display: none;
}

@media screen and (max-width: 768px) {
    /* 1. Sembunyikan seluruh struktur asli halaman */
    body > *:not(#mobile-gate) {
        display: none !important;
    }

    /* 2. Tampilkan mobile gate */
    #mobile-gate {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: #0f172a;
        z-index: 999999;
        align-items: center;
        justify-content: center;
        padding: 40px;
        box-sizing: border-box;
    }

    #mobile-gate-inner {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        max-width: 320px;
        width: 100%;
    }

    #mobile-gate .gate-emoji {
        font-size: 48px;
        margin-bottom: 8px;
    }

    #mobile-gate .gate-title {
        font-family: 'Sora', 'DM Sans', sans-serif;
        font-size: 20px;
        font-weight: 700;
        color: white;
        margin: 0;
    }

    #mobile-gate .gate-desc {
        font-family: 'DM Sans', sans-serif;
        font-size: 14px;
        color: rgba(255, 255, 255, 0.55);
        line-height: 1.6;
        margin: 0 0 16px 0;
    }

    #mobile-gate hr.gate-divider {
        border: none;
        border-top: 1px dashed rgba(255, 255, 255, 0.15);
        width: 100%;
        margin: 8px 0 16px 0;
    }

    #mobile-gate .gate-hint {
        font-family: 'DM Sans', sans-serif;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.4);
        margin: 0 0 10px 0;
    }

    #mobile-gate .btn-vote-mandiri {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 13px 20px;
        background: rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 8px;
        font-family: 'DM Sans', sans-serif;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        text-decoration: none;
        box-sizing: border-box;
        transition: all 0.2s;
        letter-spacing: 0.3px;
    }

    #mobile-gate .btn-vote-mandiri:hover,
    #mobile-gate .btn-vote-mandiri:active {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(255, 255, 255, 0.35);
        color: white;
    }

    /* Kembalikan scroll agar tidak terkunci di layar kecil */
    body {
        overflow: auto !important;
        background-image: none !important;
        background-color: #0f172a !important;
    }
}