/* ==========================================================================
   UI/UX Pro Max — Comprehensive Design System Stylesheet (uipro-theme.css)
   Project : Sistem Informasi RA V PKBGT Jemaat Tikala (DHP & E-Voting)
   Source  : UI/UX Pro Max Design Intelligence Framework
   Scope   : Applied globally to Public Portal & Admin Management Pages
   ========================================================================== */

:root {
  /* 1. Semantic Color Tokens (WCAG AA/AAA Verified) */
  --color-primary: #1E40AF;          /* Blue 800 - Dominan, Wibawa, Terpercaya */
  --color-primary-dark: #1E3A8A;     /* Blue 900 - Dark brand header */
  --color-primary-light: #EFF6FF;    /* Blue 50 - Background aksen lembut */
  --color-on-primary: #FFFFFF;

  --color-secondary: #2563EB;        /* Blue 600 - Action & Interactive */
  --color-secondary-light: #DBEAFE;  /* Blue 100 */
  --color-on-secondary: #FFFFFF;

  --color-accent: #D97706;           /* Amber 600 */
  --color-accent-bright: #F59E0B;    /* Amber 500 */
  --color-accent-light: #FFFBEB;     /* Amber 50 */
  --color-on-accent: #FFFFFF;

  --color-background: #F1F5F9;       /* Slate 100 - Lembut di mata */
  --color-foreground: #0F172A;       /* Slate 900 - Kontras tinggi */

  --color-card: #FFFFFF;
  --color-card-foreground: #0F172A;

  --color-muted: #E2E8F0;            /* Slate 200 */
  --color-muted-surface: #F8FAFC;    /* Slate 50 */
  --color-muted-foreground: #475569; /* Slate 600: Rasio kontras >= 7:1 di atas putih */

  --color-border: #E2E8F0;           /* Slate 200 */
  --color-border-strong: #CBD5E1;    /* Slate 300 */
  --color-ring: #2563EB;

  /* 2. Semantic Status Tokens (Khusus DHP & Pemilu) */
  --color-success: #059669;          /* Emerald 600 - Terverifikasi / Sah */
  --color-success-bright: #10B981;   /* Emerald 500 */
  --color-success-bg: #ECFDF5;       /* Emerald 50 */
  --color-success-border: #A7F3D0;   /* Emerald 200 */

  --color-toska: #0D9488;            /* Teal 600 - Status Hadir DHP */
  --color-toska-bg: #E6FFFA;         /* Teal 50 */
  --color-toska-border: #99F6E4;     /* Teal 200 */

  --color-warning: #D97706;          /* Amber 600 - Status Pending */
  --color-warning-bg: #FFFBEB;       /* Amber 50 */
  --color-warning-border: #FDE68A;   /* Amber 200 */

  --color-maroon: #881337;           /* Rose 900 - Status Tidak Hadir */
  --color-maroon-bg: #FFF1F2;        /* Rose 50 */
  --color-maroon-border: #FECDD3;    /* Rose 200 */

  --color-destructive: #DC2626;      /* Red 600 - Hapus / Tolak */
  --color-destructive-bg: #FEF2F2;    /* Red 50 */
  --color-destructive-border: #FECACA;
  --color-on-destructive: #FFFFFF;

  /* Legacy Alias Compatibility */
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --primary-light: var(--color-primary-light);
  --accent: var(--color-accent-bright);
  --success: var(--color-success-bright);
  --surface: var(--color-card);
  --bg-body: var(--color-background);
  --text-main: var(--color-foreground);
  --text-muted: var(--color-muted-foreground);
  --border-color: var(--color-border);

  /* 3. Typography Tokens */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* 4. 8pt Grid Spacing Tokens */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* 5. Border Radius Tokens */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* 6. Elevation / Shadow Depths */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px -5px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 20px 40px -10px rgba(30, 58, 138, 0.14);
  --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.22);
}

/* ==========================================================================
   Base & Accessibility Foundations (WCAG AA Compliant)
   ========================================================================== */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-background);
  color: var(--color-foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}

/* Heading Hierarchy */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: inherit;
  text-wrap: balance;
}

/* Ensure headings inside dark themes, hero banners, and navy backgrounds stay crisp white */
.hero-showcase,
.hero-banner,
.navbar-church,
.navbar-dark {
  color: #ffffff;
}

.hero-showcase h1, .hero-showcase h2, .hero-showcase h3, .hero-showcase h4,
.hero-banner h1, .hero-banner h2, .hero-banner h3, .hero-banner h4,
.navbar-church .navbar-brand,
.navbar-dark .navbar-brand,
.navbar-dark h1, .navbar-dark h2, .navbar-dark h3,
.admin-sidebar h1, .admin-sidebar h2, .admin-sidebar h3,
.text-white h1, .text-white h2, .text-white h3,
.hero-title-showcase,
.hero-title-main {
  color: #ffffff !important;
}

/* Text Muted Contrast Guard (WCAG AA >= 4.5:1) */
.text-muted,
.text-secondary {
  color: var(--color-muted-foreground) !important;
}

/* Tabular Numbers */
.tabular-nums,
.stat-card-modern .fw-extrabold,
.hero-mini-stat .fw-extrabold,
.kelompok-num-avatar,
.kelompok-count-pill,
.count-pill,
.voter-num-pill,
.page-num-pill,
.font-monospace {
  font-variant-numeric: tabular-nums;
}

/* Skip Link untuk Aksesibilitas Keyboard */
.uipro-skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 2000;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transition: top 0.2s ease;
}

.uipro-skip-link:focus {
  top: 12px;
  color: var(--color-on-primary);
  outline: 3px solid var(--color-accent-bright);
}

/* Focus Visible Global Ring (WCAG 2.4.7) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.mobile-nav-item:focus-visible,
.filter-chip:focus-visible,
.action-hub-card:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.38) !important;
}

/* Badge & Chip Wrap Guard */
.badge,
.filter-chip,
.kelompok-count-pill,
.hero-badge,
.hero-live-badge,
.hero-kelompok-badge,
.badge-absen-pill {
  white-space: nowrap;
}

/* Mobile Input Zoom Prevention (iOS Safari requires >= 16px) */
input.form-control,
select.form-select,
textarea.form-control,
.hero-search-input,
.search-input-clean,
.input-clean,
.select-kelompok-modern {
  font-size: 1rem !important;
}

/* Minimum Touch Target (>= 44px) */
.btn-uipro-touch,
.btn-church-primary,
.btn-coblos,
.btn-page-nav,
.mobile-nav-item,
.btn-lg {
  min-height: 44px;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Selection Highlight */
::selection {
  background: #dbeafe;
  color: #1e3a8a;
}

/* ==========================================================================
   UI/UX Pro Max Component System
   ========================================================================== */

/* 1. BUTTONS */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 8px 18px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

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

.btn-primary,
.btn-church-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border: none;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover,
.btn-church-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e3a8a 100%);
  color: #ffffff !important;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-outline-primary {
  border: 1.5px solid #2563eb;
  color: #2563eb !important;
  background: transparent;
}

.btn-outline-primary:hover {
  background: #eff6ff;
  color: #1d4ed8 !important;
  border-color: #1d4ed8;
  transform: translateY(-1.5px);
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border: none;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  color: #ffffff !important;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 18px rgba(5, 150, 105, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border: none;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  color: #ffffff !important;
  transform: translateY(-1.5px);
}

.btn-light {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #334155 !important;
}

.btn-light:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a !important;
}

/* 2. CARDS & ELEVATIONS */
.card,
.card-custom,
.card-panel,
.uipro-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 200ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 200ms ease;
}

.card-hover:hover,
.uipro-card-interactive:hover {
  transform: translateY(-3px);
  border-color: #93c5fd;
  box-shadow: var(--shadow-md);
}

/* 3. FORM CONTROLS */
.form-control,
.form-select {
  border-radius: var(--radius-md);
  border: 1.5px solid #cbd5e1;
  padding: 10px 14px;
  background-color: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  color: var(--color-foreground);
}

.form-control:focus,
.form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
  background-color: #ffffff;
}

.input-group-text {
  border-radius: var(--radius-md);
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
}

/* 4. BADGES & ABSENSI STATUS PILLS */
.badge {
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 10px;
  border-radius: var(--radius-full);
}

/* Absensi Pill Badges */
.badge-absen-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-full);
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-absen-hadir,
.badge-toska-pill {
  background-color: var(--color-toska-bg) !important;
  color: var(--color-toska) !important;
  border: 1px solid var(--color-toska-border) !important;
}

.badge-absen-tidak,
.badge-maroon-pill {
  background-color: var(--color-maroon-bg) !important;
  color: var(--color-maroon) !important;
  border: 1px solid var(--color-maroon-border) !important;
}

.badge-absen-belum {
  background-color: #f8fafc !important;
  color: #94a3b8 !important;
  border: 1px solid #e2e8f0 !important;
}

/* 5. TABLES */
.table-detail-modern,
.table-uipro-pemilih,
.table-modern {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table-detail-modern thead th,
.table-uipro-pemilih thead th,
.table-modern thead th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 800;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1.5px solid #e2e8f0;
  padding: 14px 16px;
}

.table-detail-modern thead th:first-child,
.table-uipro-pemilih thead th:first-child,
.table-modern thead th:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
  border-left: 1px solid #e2e8f0;
}

.table-detail-modern thead th:last-child,
.table-uipro-pemilih thead th:last-child,
.table-modern thead th:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
  border-right: 1px solid #e2e8f0;
}

.table-detail-modern tbody td,
.table-uipro-pemilih tbody td,
.table-modern tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.table-detail-modern tbody tr:hover td,
.table-uipro-pemilih tbody tr:hover td,
.table-modern tbody tr:hover td {
  background-color: #f8fbff;
}

/* 6. ALERTS & FEEDBACK */
.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 14px 18px;
  font-weight: 500;
  border-left-width: 4px;
}

.alert-success {
  background-color: var(--color-success-bg);
  border-color: var(--color-success-border);
  border-left-color: var(--color-success);
  color: #065f46;
}

.alert-danger {
  background-color: var(--color-destructive-bg);
  border-color: var(--color-destructive-border);
  border-left-color: var(--color-destructive);
  color: #991b1b;
}

.alert-warning {
  background-color: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  border-left-color: var(--color-warning);
  color: #92400e;
}

.alert-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #2563eb;
  color: #1e40af;
}

/* 7. MODALS */
.modal-content {
  border-radius: var(--radius-xl);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid #f1f5f9;
  padding: 18px 24px;
  background: #f8fafc;
}

.modal-footer {
  border-top: 1px solid #f1f5f9;
  padding: 14px 24px;
  background: #f8fafc;
}

/* 8. PROGRESS BARS */
.uipro-progress-track {
  height: 8px;
  background: var(--color-muted);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.uipro-progress-fill-high {
  background: linear-gradient(90deg, #10B981 0%, #059669 100%);
}

.uipro-progress-fill-mid {
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.uipro-progress-fill-low {
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
}

/* ==========================================================================
   Reduced Motion Preference (WCAG 2.3.3)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
