/* ==========================================================================
   SATU SUARA - ULTRA MODERN VIBRANT DESIGN SYSTEM (FULLY RESPONSIVE)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');

:root {
  --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Color Palette */
  --bg-dark: #090d16;
  --bg-dark-card: rgba(15, 23, 42, 0.85);
  --bg-light: #f8fafc;

  --sidebar-width: 265px;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  
  --secondary: #ec4899;
  --secondary-hover: #db2777;

  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-violet: #8b5cf6;

  /* Premium Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-vibrant: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%);
  --gradient-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-amber: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

  /* Glassmorphism Tokens */
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-bg-dark: rgba(15, 23, 42, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-border-dark: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  --glass-shadow-dark: 0 25px 50px rgba(0, 0, 0, 0.4);

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

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

html, body {
  width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-light);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.12) 0px, transparent 40%),
    radial-gradient(at 90% 90%, rgba(236, 72, 153, 0.12) 0px, transparent 40%),
    radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.08) 0px, transparent 60%);
  background-attachment: fixed;
}

body.dark-theme {
  background-color: var(--bg-dark);
  color: #f8fafc;
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.25) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(236, 72, 153, 0.2) 0px, transparent 50%),
    radial-gradient(at 50% 30%, rgba(139, 92, 246, 0.15) 0px, transparent 60%);
}

/* Glass Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 100%;
}

body.dark-theme .glass-card {
  background: var(--glass-bg-dark);
  border-color: var(--glass-border-dark);
  box-shadow: var(--glass-shadow-dark);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
}

/* ADMIN LAYOUT & RESPONSIVE SIDEBAR */
.admin-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  width: 100%;
}

.mobile-top-bar {
  display: none;
  background: rgba(11, 15, 25, 0.95);
  color: #fff;
  padding: 0.85rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 300;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar {
  width: var(--sidebar-width);
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(24px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 400;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 1.75rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: #ffffff;
  text-decoration: none;
}

.sidebar-menu {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-md);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.25s ease;
}

.sidebar-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.sidebar-item.active {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.5rem;
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
  overflow-x: hidden;
}

/* Mobile Sidebar Backdrop Overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 350;
}

/* Public Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

body.dark-theme .navbar {
  background: rgba(11, 15, 25, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.35rem;
  background: var(--gradient-vibrant);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.brand-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--text-white);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
  transform: translateY(-2px);
}

.btn-success {
  background: var(--gradient-emerald);
  color: var(--text-white);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.45);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: var(--text-white);
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

body.dark-theme .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* LOGIN CARD & LARGE QR SCANNER AREA */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 85px);
  padding: 2rem 1.25rem;
  width: 100%;
}

.auth-card {
  width: 100%;
  max-width: 560px;
  padding: 2.75rem 2.25rem;
  background: rgba(255, 255, 255, 0.94);
}

body.dark-theme .auth-card {
  background: rgba(15, 23, 42, 0.92);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-box {
  width: 85px;
  height: 85px;
  border-radius: 50%;
  background: #ffffff;
  padding: 0.75rem;
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.25);
  border: 4px solid var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.15rem auto;
}

.auth-logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* LARGE SCANNER VIEWPORT STYLES (WITH HORIZONTAL MIRROR EFFECT FOR INTUITIVE ALIGNMENT) */
.qr-scanner-wrapper {
  width: 100%;
  min-height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 3px dashed var(--primary);
  background: rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.1);
}

#qr-reader {
  width: 100% !important;
  border: none !important;
}

#qr-reader video, #qr-reader canvas {
  border-radius: var(--radius-md) !important;
  object-fit: cover !important;
  width: 100% !important;
  max-height: 380px !important;
  transform: scaleX(-1) !important;
  -webkit-transform: scaleX(-1) !important;
}

/* Tabs Switcher */
.tab-group {
  display: flex;
  background: rgba(226, 232, 240, 0.75);
  padding: 5px;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

body.dark-theme .tab-group {
  background: rgba(30, 41, 59, 0.7);
}

.tab-btn {
  flex: 1;
  padding: 0.8rem;
  border: none;
  background: transparent;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

body.dark-theme .tab-btn.active {
  background: #1e293b;
  color: #a5b4fc;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

body.dark-theme .form-control {
  background: rgba(30, 41, 59, 0.8);
  border-color: #475569;
  color: #ffffff;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

/* CANDIDATE CARDS GRID (RESPONSIVE FOR ALL DEVICES) */
.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
  margin-top: 1.5rem;
  width: 100%;
}

.candidate-card {
  position: relative;
  overflow: hidden;
  padding: 1.85rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 6px solid var(--primary);
}

.candidate-number {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.photos-wrapper {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.photo-box {
  text-align: center;
}

.photo-box img {
  width: 110px;
  height: 135px;
  object-fit: contain;
  background: rgba(15, 23, 42, 0.04);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border: 3px solid #ffffff;
}

.photo-box span {
  display: block;
  margin-top: 0.5rem;
  font-weight: 800;
  font-size: 0.88rem;
}

.photo-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.vision-box {
  background: rgba(241, 245, 249, 0.85);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
}

body.dark-theme .vision-box {
  background: rgba(30, 41, 59, 0.8);
}

/* Category Badge Colors */
.badge-category {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-siswa { background: #e0f2fe; color: #0284c7; }
.badge-guru { background: #dcfce7; color: #15803d; }
.badge-pembina { background: #fef3c7; color: #b45309; }
.badge-manajemen { background: #f3e8ff; color: #7e22ce; }
.badge-kepala { background: #ffe4e6; color: #be123c; }

/* Responsive Table Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.alert {
  padding: 0.95rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ==========================================================================
   BREAKPOINTS & RESPONSIVE MEDIA QUERIES (SMARTPHONE, TABLET, DESKTOP)
   ========================================================================== */

/* 1. TABLET & SMALL LAPTOPS (max-width: 992px) */
@media (max-width: 992px) {
  .mobile-top-bar {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-backdrop.active {
    display: block;
  }

  .admin-main-content {
    margin-left: 0;
    width: 100%;
    padding: 1.5rem 1.15rem;
  }

  .navbar {
    padding: 1rem 1.25rem;
  }

  .candidate-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
  }
}

/* 2. SMARTPHONES & SMALL MOBILE DEVICES (max-width: 576px) */
@media (max-width: 576px) {
  .navbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .brand-logo {
    font-size: 1.15rem;
  }
  .brand-logo img {
    height: 30px !important;
    width: 30px !important;
  }
  .brand-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }

  .auth-wrapper {
    padding: 1rem 0.75rem;
  }

  .auth-card {
    padding: 1.75rem 1.15rem;
    border-radius: var(--radius-md);
  }

  .auth-logo-box {
    width: 70px;
    height: 70px;
    padding: 0.5rem;
    margin-bottom: 0.85rem;
  }

  .tab-btn {
    font-size: 0.82rem;
    padding: 0.65rem 0.4rem;
  }

  .btn {
    padding: 0.75rem 1.15rem;
    font-size: 0.88rem;
    width: 100%;
  }

  .btn-lg {
    padding: 0.85rem 1.35rem;
    font-size: 0.95rem;
  }

  .candidate-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .candidate-card {
    padding: 1.35rem 1rem;
  }

  .photos-wrapper {
    gap: 0.65rem;
  }

  .photo-box img {
    width: 92px;
    height: 115px;
  }

  .photo-box span {
    font-size: 0.8rem;
  }

  .qr-scanner-wrapper {
    min-height: 240px;
  }

  .glass-card {
    border-radius: var(--radius-md);
  }
}
