/* ============================================================
   Ayo Memilih - Premium Modern Single-Screen Design System
   Sistem Antarmuka Modern, Padat 1 Layar Tanpa Scroll (Mobile & Desktop)
   ============================================================ */

:root {
  /* Brand & Theme Colors */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  --primary-gradient-hover: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  
  --secondary: #0f172a;
  --secondary-hover: #1e293b;
  --accent: #06b6d4;
  --accent-light: #ecfeff;
  
  --success: #10b981;
  --success-hover: #059669;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #6366f1;
  
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.2);
  
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.03) 0px, transparent 50%),
                    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.03) 0px, transparent 50%);
  color: var(--text-main);
  line-height: 1.45;
  font-size: 0.9rem;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------------- Layout & Containers ---------------- */
.app-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.5rem 0.5rem;
}

.container-compact {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.container-narrow {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.container-wide {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 0.75rem;
}

/* ---------------- Top Navbar ---------------- */
.top-nav {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.03);
}

.top-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
  gap: 0.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--secondary);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  background: var(--primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(79, 70, 229, 0.25);
}

.brand-badge {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-size: 0.625rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.status-indicator.open {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.status-indicator.closed {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-indicator.open .status-dot {
  animation: pulseDot 2s infinite ease-in-out;
}

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

/* ---------------- Hero Section & Badges ---------------- */
.hero-header {
  text-align: center;
  margin-bottom: 0.85rem;
  padding: 0;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 700;
  color: #4338ca;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
  border: 1px solid rgba(79, 70, 229, 0.2);
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.4rem;
}

.hero-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.15rem;
}

.hero-org {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------------- Cards & Boxes ---------------- */
.card-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-compact:hover {
  border-color: #cbd5e1;
}

.card-compact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.5rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.01em;
}

.step-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover {
  background: var(--primary-gradient-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-gradient);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.28);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: #ffffff;
  border-color: var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
  color: var(--secondary);
}

.btn-danger-outline {
  background: transparent;
  border-color: var(--danger-border);
  color: var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.775rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 0.7rem 1.2rem;
  font-size: 0.925rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* ---------------- Form Elements ---------------- */
.form-group {
  margin-bottom: 0.85rem;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 0.35rem;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-xs);
  outline: none;
  transition: all 0.18s ease;
}

.input-icon-wrap .form-input {
  padding-left: 2.4rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

.form-input-lg {
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.input-icon-wrap .form-input-lg {
  padding-left: 2.6rem;
}

.form-hint {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.35;
}

/* ---------------- Alerts & Notices ---------------- */
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  line-height: 1.4;
  box-shadow: var(--shadow-xs);
}

.alert-info {
  background: #f0f7ff;
  color: #1e3a8a;
  border: 1px solid #bae6fd;
  border-left: 3.5px solid #0284c7;
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border: 1px solid var(--success-border);
  border-left: 3.5px solid var(--success);
}

.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border: 1px solid var(--warning-border);
  border-left: 3.5px solid var(--warning);
}

.alert-danger {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid var(--danger-border);
  border-left: 3.5px solid var(--danger);
}

/* ---------------- Grid Bilik Suara ---------------- */
.ballot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.candidate-compact-card {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.candidate-compact-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.candidate-badge-num {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  min-width: 32px;
  height: 32px;
  padding: 0 5px;
  border-radius: var(--radius-xs);
  background: var(--secondary);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.candidate-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.candidate-avatar {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  background: var(--bg-subtle);
}

.candidate-info {
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.candidate-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 0.15rem;
  line-height: 1.3;
}

.candidate-vice {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.candidate-tagline {
  font-size: 0.775rem;
  font-style: italic;
  color: #475569;
  background: var(--bg-subtle);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-xs);
  margin-bottom: 0.75rem;
  line-height: 1.35;
  border-left: 2.5px solid var(--border-color);
}

.candidate-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
}

/* ---------------- Data Tables ---------------- */
.data-table-compact {
  width: 100%;
  border-collapse: collapse;
}

.data-table-compact tr {
  border-bottom: 1px solid var(--border-color);
}
.data-table-compact tr:last-child {
  border-bottom: none;
}

.data-table-compact td {
  padding: 0.5rem 0.4rem;
  font-size: 0.825rem;
}

.data-table-compact td:first-child {
  color: var(--text-muted);
  font-weight: 500;
  width: 38%;
}

.data-table-compact td:last-child {
  color: var(--secondary);
  font-weight: 600;
}

/* ---------------- Digital Struk / Receipt ---------------- */
.receipt-box {
  background: #ffffff;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.receipt-stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border: 1.5px solid var(--success);
  background: var(--success-light);
  color: var(--success);
  border-radius: var(--radius-xs);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.receipt-code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 800;
  background: var(--bg-subtle);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xs);
  display: inline-block;
  color: var(--primary);
  border: 1px solid var(--primary-border);
  letter-spacing: 1px;
}

/* ---------------- Quick Count Progress & Bars ---------------- */
.qc-bar-wrapper {
  background: #e2e8f0;
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  margin: 0.35rem 0;
  position: relative;
}

.qc-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--primary-gradient);
}

/* ---------------- Modal Backdrop & Dialog ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--secondary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.25rem;
}

.modal-body {
  padding: 1.15rem;
  max-height: 70vh;
  overflow-y: auto;
  font-size: 0.85rem;
}

.modal-footer {
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  background: #f8fafc;
}

/* ---------------- Footer & Hidden Gear Button ---------------- */
.app-footer {
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  padding: 0.5rem 0;
  margin-top: auto;
  font-size: 0.775rem;
  color: var(--text-muted);
  position: relative;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 32px;
}

.footer-text {
  text-align: center;
}

.admin-gear-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-full);
  text-decoration: none;
  opacity: 0.25;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-gear-btn:hover {
  opacity: 0.95;
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-50%) rotate(90deg);
}

/* ---------------- Print Styles ---------------- */
@media print {
  .top-nav, .app-footer, .no-print {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
  .main-content {
    padding: 0;
  }
  .receipt-box {
    border: 1.5px solid #000;
    box-shadow: none;
  }
}

/* ---------------- Responsive Styles ---------------- */
@media (max-width: 640px) {
  .top-nav-inner {
    padding: 0 0.75rem;
    height: 48px;
  }
  .brand-logo span {
    font-size: 0.925rem;
  }
  .brand-badge {
    display: none;
  }
  .status-indicator span:last-child {
    font-size: 0.675rem;
  }
  .hero-title {
    font-size: 1.15rem;
  }
  .card-compact {
    padding: 1rem 1rem;
    border-radius: var(--radius-sm);
  }
  .container-compact, .container-narrow {
    padding: 0 0.35rem;
  }
  .main-content {
    padding: 0.4rem 0.35rem;
  }
}
