/* ==========================================================================
   E-Voting Bujang Gadis Muhammadiyah 1 Palembang - Master CSS (Premium & Interactive)
   ========================================================================== */

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

:root {
  --primary: #00674f;
  --primary-dark: #004d3b;
  --primary-light: #008767;
  --primary-subtle: #e6f3f0;
  
  --accent: #41a0b0;
  --accent-dark: #2c7987;
  --accent-light: #eef8fa;

  --bujang-badge: #2563eb;
  --gadis-badge: #ec4899;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);

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

  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 67, 79, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 67, 79, 0.12);
  --shadow-glow: 0 0 20px rgba(0, 103, 79, 0.25);
  
  --sidebar-width: 260px;
  --navbar-height: 64px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: url('/img/pattern-bg.svg');
  background-size: 400px 400px;
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   LAYOUT: DESKTOP SIDEBAR vs MOBILE NAVBAR
   ========================================================================== */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Desktop Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--primary-subtle);
  padding: 4px;
  animation: pulse 2s infinite;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--primary-subtle);
  color: var(--primary);
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: var(--shadow-md);
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px 100px 32px;
  min-height: 100vh;
  transition: all 0.3s ease;
  animation: fadeIn 0.4s ease-out;
}

.app-main.login-layout {
  margin-left: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* Mobile Top Header */
.mobile-top-header {
  display: none;
  height: var(--navbar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

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

.mobile-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.mobile-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.mobile-nav-btn.active {
  color: var(--primary);
  transform: scale(1.05);
}

.mobile-nav-btn svg {
  width: 22px;
  height: 22px;
}

/* Mobile Styles Threshold (< 768px) */
@media (max-width: 767px) {
  .app-sidebar {
    display: none;
  }
  .mobile-top-header {
    display: flex;
    height: 56px;
  }
  .mobile-bottom-nav {
    display: flex;
    height: 60px;
    z-index: 1000;
  }
  .app-main {
    margin-left: 0;
    padding: calc(56px + 14px) 12px 150px 12px;
  }
  .hero-card {
    padding: 20px 16px;
    margin-bottom: 20px;
  }
  .hero-title {
    font-size: 20px;
  }
  .hero-desc {
    font-size: 12px;
  }
  .section-header {
    margin-top: 14px;
    margin-bottom: 12px;
  }
  .section-title {
    font-size: 16px;
  }
  .candidate-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 24px;
  }
  .candidate-photo-wrapper {
    aspect-ratio: 9 / 16 !important;
    max-height: none !important;
  }
  .candidate-info {
    padding: 10px 8px !important;
  }
  .candidate-name {
    font-size: 13px !important;
    line-height: 1.2;
    margin-bottom: 2px;
  }
  .candidate-class {
    font-size: 11px !important;
    margin-bottom: 6px !important;
  }
  .candidate-vm-btn {
    font-size: 11px !important;
    margin-bottom: 8px !important;
    padding: 0;
  }
  .candidate-select-btn {
    padding: 8px 4px !important;
    font-size: 12px !important;
    border-radius: var(--radius-sm);
  }
  .candidate-num-badge {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
    top: 6px !important;
    left: 6px !important;
    border-width: 1.5px;
  }
}

/* ==========================================================================
   COMPONENTS & UI ELEMENTS
   ========================================================================== */

/* Hero Banner */
.hero-card {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
  color: var(--text-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.25;
}

.hero-desc {
  font-size: 14px;
  opacity: 0.9;
  max-width: 600px;
}

/* Verification Form Container */
.verify-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  margin: 20px auto;
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.verify-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.verify-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-subtle);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  transition: transform 0.5s ease;
}

.verify-card:hover .verify-icon {
  transform: rotate(360deg);
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 103, 79, 0.15);
}

.input-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-main);
}

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

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-full {
  width: 100%;
}

/* Candidate Grid - Responsive 3-4 Columns on Desktop */
.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

/* Candidate Card */
.candidate-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: cardFadeIn 0.5s ease-out;
}

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

.candidate-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 103, 79, 0.25), var(--shadow-lg);
  background: var(--primary-subtle);
}

/* Aspect Ratio 9:16 Portrait */
.candidate-photo-wrapper {
  width: 100%;
  aspect-ratio: 9 / 16;
  position: relative;
  background: #e2e8f0;
  overflow: hidden;
}

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

.candidate-card:hover .candidate-photo {
  transform: scale(1.05);
}

.candidate-num-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  border: 2px solid #ffffff;
}

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

.candidate-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
  line-height: 1.3;
}

.candidate-class {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 10px;
}

.candidate-vm-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  text-align: left;
  transition: color 0.2s ease;
}

.candidate-vm-btn:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.candidate-select-btn {
  margin-top: auto;
  width: 100%;
  padding: 9px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.candidate-card.selected .candidate-select-btn {
  background: var(--primary);
  color: #ffffff;
}

.candidate-select-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

/* Floating Sticky Submit Bar */
.submit-vote-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 14px 28px;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 767px) {
  .submit-vote-bar {
    left: 0;
    bottom: 60px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }
}

.selection-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}

.selection-pill {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--border);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.selection-pill.selected {
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary);
  transform: scale(1.05);
}

/* Modal Windows */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  position: relative;
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #ef4444;
}

/* Drag and Drop Excel Area */
.drag-drop-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  background: var(--bg-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.drag-drop-area.dragover {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: scale(1.01);
}

/* Confetti Styles */
.confetti-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  z-index: 9999;
  pointer-events: none;
  border-radius: 50%;
  animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Responsive Customization */
.gender-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.gender-badge.bujang { background: var(--bujang-badge); }
.gender-badge.gadis { background: var(--gadis-badge); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  margin-top: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  background: var(--bg-main);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #ffffff;
  border-left: 4px solid var(--primary);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.error { border-left-color: #ef4444; }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.pwa-banner {
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
