/* ==========================================================================
   E-PILKETOS SMP NEGERI 1 DANDER - MAIN STYLESHEET
   Mobile-First, Ultra Lightweight, Clean & Modern Design
   ========================================================================== */

:root {
  --navy: #142B4A;
  --navy-light: #1E3A8A;
  --primary-blue: #2563EB;
  --primary-hover: #1D4ED8;
  --light-blue: #EFF6FF;
  --light-blue-border: #BFDBFE;
  --gold: #F5B942;
  --gold-dark: #D97706;
  --white: #FFFFFF;
  --bg-color: #F5F7FB;
  --card-bg: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --success: #10B981;
  --danger: #EF4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(20,43,74,0.08);
  --shadow-lg: 0 10px 25px rgba(20,43,74,0.12);
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   CONTAINER & LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 12px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  padding: 2px;
  flex-shrink: 0;
}

.brand-info h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-info p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-open {
  background: #D1FAE5;
  color: #065F46;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.badge-paused {
  background: #FEF3C7;
  color: #92400E;
}

.badge-closed {
  background: #FEE2E2;
  color: #991B1B;
}

/* User Pill in Header */
.user-pill {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.user-pill-logout {
  color: #FCA5A5;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.user-pill-logout:hover {
  color: #FFFFFF;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, var(--primary-blue) 100%);
  color: var(--white);
  padding: 28px 16px;
  text-align: center;
  border-bottom: 4px solid var(--gold);
}

.hero-subtitle-badge {
  display: inline-block;
  background: rgba(245, 185, 66, 0.2);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.hero h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
  line-height: 1.25;
}

.hero p {
  font-size: 0.95rem;
  color: #E2E8F0;
  max-width: 600px;
  margin: 0 auto;
}

.hero-guide {
  margin-top: 18px;
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-size: 0.8rem;
  color: #F8FAFC;
}

.hero-guide-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-num {
  width: 20px;
  height: 20px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 24px 0 40px;
}

.section-title-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
}

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   CANDIDATE CARDS (GRID)
   ========================================================================== */
.candidates-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

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

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

.candidate-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.candidate-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--light-blue-border);
}

.candidate-badge-num {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 900;
  font-size: 1.1rem;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
}

.candidate-badge-num span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Photos Container: 2 photos side-by-side or stacked */
.candidate-photos {
  display: flex;
  width: 100%;
  height: 220px;
  background: #E2E8F0;
  overflow: hidden;
  border-bottom: 2px solid var(--gold);
}

.photo-box {
  flex: 1;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.photo-box:not(:last-child) {
  border-right: 2px solid #FFFFFF;
}

.photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.3s ease;
}

.candidate-card:hover .photo-box img {
  transform: scale(1.03);
}

.photo-label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  background: rgba(20, 43, 74, 0.88);
  color: #FFFFFF;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  backdrop-filter: blur(2px);
}

.candidate-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.candidate-names {
  margin-bottom: 12px;
}

.candidate-lead {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.candidate-vice {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.candidate-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.75rem;
}

.candidate-class-tag {
  background: var(--light-blue);
  color: var(--primary-blue);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--light-blue-border);
}

.candidate-visi-snip {
  font-size: 0.82rem;
  color: #475569;
  background: #F8FAFC;
  padding: 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-blue);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-style: italic;
}

.candidate-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   BUTTONS (Touch-friendly, min-height: 44px)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-align: center;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: var(--white);
  box-shadow: 0 3px 8px rgba(37,99,235,0.3);
}

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

.btn-vote {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  font-size: 1rem;
}

.btn-vote:hover {
  background: linear-gradient(135deg, #1D4ED8 0%, #1E3A8A 100%);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: var(--white);
  border-color: var(--border-color);
  color: var(--navy);
}

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

.btn-gold {
  background-color: var(--gold);
  color: var(--navy);
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(245,185,66,0.35);
}

.btn-gold:hover {
  background-color: var(--gold-dark);
  color: var(--white);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background-color: #DC2626;
}

.btn-secondary {
  background-color: #E2E8F0;
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: #CBD5E1;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ==========================================================================
   LOGIN CARD (NISN ONLY)
   ========================================================================== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
  padding: 20px 16px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--primary-blue) 100%);
  color: var(--white);
  padding: 28px 20px;
  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.login-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.85rem;
  color: #E2E8F0;
}

.login-body {
  padding: 24px 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 1.15rem;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #FFFFFF;
  color: var(--text-main);
  transition: var(--transition);
  text-align: center;
  letter-spacing: 2px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-danger {
  background-color: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #991B1B;
}

.alert-warning {
  background-color: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
}

.alert-info {
  background-color: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
}

.alert-success {
  background-color: #D1FAE5;
  border: 1px solid #6EE7B7;
  color: #065F46;
}

/* ==========================================================================
   MODALS (VISI-MISI & KONFIRMASI)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  0% { transform: scale(0.92) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.modal-close:hover {
  background: rgba(255,255,255,0.15);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.9rem;
}

.modal-footer {
  padding: 14px 20px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
}

/* Detail Visi-Misi Modal specifics */
.misi-list {
  padding-left: 20px;
  margin-top: 8px;
}

.misi-list li {
  margin-bottom: 8px;
  line-height: 1.4;
  color: #334155;
}

/* ==========================================================================
   SUCCESS SCREEN
   ========================================================================== */
.success-screen {
  text-align: center;
  padding: 40px 16px;
  max-width: 500px;
  margin: 40px auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.success-icon-wrap {
  width: 80px;
  height: 80px;
  background: #D1FAE5;
  color: #10B981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: successPop 0.5s ease-out;
}

@keyframes successPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.success-screen h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 12px;
}

.success-screen p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ==========================================================================
   HIDDEN NISN SEARCH & AUTOSUGGEST
   ========================================================================== */
.login-tabs {
  display: flex;
  background: #E2E8F0;
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  gap: 4px;
}

.login-tab-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-tab-btn.active {
  background: #FFFFFF;
  color: var(--primary-blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nisn-helper-wrap {
  text-align: center;
  margin-top: 14px;
}

.btn-nisn-helper {
  background: none;
  border: none;
  color: var(--primary-blue);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  opacity: 0.85;
}

.btn-nisn-helper:hover {
  background: var(--light-blue);
  opacity: 1;
}

.suggest-container {
  margin-top: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
  background: #FFFFFF;
}

.suggest-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 48px;
}

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

.suggest-item:hover, .suggest-item.active {
  background-color: var(--light-blue);
}

.suggest-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.suggest-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--navy);
}

.suggest-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggest-nisn-code {
  font-family: monospace;
  font-weight: 700;
  background: #E2E8F0;
  color: var(--navy);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.suggest-action {
  flex-shrink: 0;
}

.suggest-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@keyframes nisnFilledHighlight {
  0% { background-color: #FEF08A; border-color: #EAB308; transform: scale(1.02); }
  50% { background-color: #D1FAE5; border-color: #10B981; }
  100% { background-color: #FFFFFF; border-color: var(--primary-blue); transform: scale(1); }
}

.nisn-highlight {
  animation: nisnFilledHighlight 1.2s ease-out;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  background: var(--navy);
  color: #94A3B8;
  padding: 20px 16px;
  font-size: 0.8rem;
  text-align: center;
  margin-top: auto;
  border-top: 3px solid var(--primary-blue);
}

.site-footer a {
  color: var(--gold);
}

/* ==========================================================================
   RESPONSIVE DESIGN (320px, 360px, 390px, tablets)
   ========================================================================== */
@media (max-width: 360px) {
  body {
    font-size: 14px;
  }
  .brand-info h1 {
    font-size: 0.85rem;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
  }
  .hero h2 {
    font-size: 1.25rem;
  }
  .candidate-photos {
    height: 180px;
  }
  .btn {
    font-size: 0.85rem;
    padding: 8px 12px;
  }
}

