/* ================================================
   PS. AGAPE Presensi – Custom Stylesheet
   ================================================ */

/* ------------------------------------------------
   Root Variables
   ------------------------------------------------ */
:root {
  --purple-dark:   #1a1a2e;
  --purple-mid:    #16213e;
  --purple-accent: #7c3aed;
  --purple-light:  #a78bfa;
  --glass-bg:      rgba(255, 255, 255, 0.07);
  --glass-border:  rgba(255, 255, 255, 0.12);
  --text-white:    rgba(255, 255, 255, 0.95);
  --text-muted:    rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------
   Public Page Body & Background
   ------------------------------------------------ */
.public-body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: transparent;
  min-height: 100vh;
}

.public-bg {
  min-height: 100vh;
  background: linear-gradient(
    135deg,
    #1a1a2e 0%,
    #16213e 30%,
    #0f3460 65%,
    #533483 100%
  );
  background-attachment: fixed;
}

/* ------------------------------------------------
   App Header
   ------------------------------------------------ */
.app-logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.45);
}

.app-title {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.app-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

/* ------------------------------------------------
   Glassmorphism Card
   ------------------------------------------------ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  margin-bottom: 1.25rem;
}

/* ------------------------------------------------
   No Schedule State
   ------------------------------------------------ */
.no-schedule-icon {
  font-size: 3.5rem;
  color: rgba(255,255,255,0.35);
  line-height: 1;
}

.upcoming-schedule-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.upcoming-schedule-item:last-child { border-bottom: none; }

/* ------------------------------------------------
   Schedule Info Card
   ------------------------------------------------ */
.schedule-icon {
  width: 48px;
  height: 48px;
  background: rgba(124, 58, 237, 0.25);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #a78bfa;
  flex-shrink: 0;
}

/* ------------------------------------------------
   GPS Status
   ------------------------------------------------ */
.gps-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.gps-icon.loading {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  animation: pulse 1.5s infinite;
}

.gps-icon.success {
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
}

.gps-icon.error {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ------------------------------------------------
   Attendance Tabs
   ------------------------------------------------ */
.attendance-tabs {
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.15);
  border-radius: 0;
}

.attendance-tabs .nav-link {
  color: rgba(255,255,255,0.55);
  border: none;
  border-radius: 0;
  padding: 0.9rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.2s, border-bottom 0.2s;
  border-bottom: 2px solid transparent;
}

.attendance-tabs .nav-link:hover {
  color: rgba(255,255,255,0.85);
}

.attendance-tabs .nav-link.active {
  color: #fff;
  background: transparent;
  border-bottom: 2px solid #a78bfa;
  font-weight: 600;
}

/* ------------------------------------------------
   Form Controls (Public)
   ------------------------------------------------ */
.attendance-input {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  color: #fff !important;
  border-radius: 0.6rem !important;
}

.attendance-input:focus {
  background: rgba(255,255,255,0.12) !important;
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25) !important;
  color: #fff !important;
}

.attendance-input::placeholder { color: rgba(255,255,255,0.35) !important; }

textarea.attendance-input { resize: vertical; }

/* ------------------------------------------------
   Camera & Face Detection
   ------------------------------------------------ */
.camera-wrapper {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}

#selfieVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1); /* Mirror effect */
}

#selfieOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1);
}

.camera-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  color: #fff;
}

.btn-capture {
  background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
  border: none !important;
  border-radius: 0.75rem !important;
  padding: 0.8rem !important;
  font-weight: 600 !important;
  font-size: 1rem !important;
}

.captured-preview {
  max-width: 100%;
  border-radius: 0.75rem;
  max-height: 250px;
  object-fit: cover;
}

/* ------------------------------------------------
   Identify Result
   ------------------------------------------------ */
.identify-result {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  color: rgba(255,255,255,0.8);
  font-size: 0.88rem;
}

.identify-result.success {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.3);
  color: #4ade80;
}

.identify-result.error {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
  color: #f87171;
}

/* ------------------------------------------------
   Member Found Card
   ------------------------------------------------ */
.member-found-card {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}

.member-avatar {
  font-size: 1.8rem;
  color: rgba(255,255,255,0.4);
  line-height: 1;
}

/* ------------------------------------------------
   Status Radio Buttons
   ------------------------------------------------ */
.status-radio {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.status-radio:has(.form-check-input:checked) {
  background: rgba(124,58,237,0.2);
  border-color: rgba(124,58,237,0.5);
}

.status-radio .form-check-input { cursor: pointer; }
.status-radio .form-check-label { cursor: pointer; }

/* ------------------------------------------------
   Buttons (Public)
   ------------------------------------------------ */
.btn-purple {
  background: rgba(124,58,237,0.8);
  color: #fff;
  border: none;
}
.btn-purple:hover {
  background: #7c3aed;
  color: #fff;
}

.btn-success { border-radius: 0.6rem !important; }
.btn-warning { border-radius: 0.6rem !important; }

/* ------------------------------------------------
   Badge
   ------------------------------------------------ */
.bg-purple { background-color: #7c3aed !important; }

/* ------------------------------------------------
   Toast Notifications
   ------------------------------------------------ */
.toast {
  border-radius: 0.75rem !important;
  font-size: 0.9rem;
}

/* ------------------------------------------------
   Leaderboard Medals (Admin)
   ------------------------------------------------ */
.rank-1-row { background: linear-gradient(90deg, rgba(251,191,36,0.08), transparent) !important; }
.rank-2-row { background: linear-gradient(90deg, rgba(148,163,184,0.08), transparent) !important; }
.rank-3-row { background: linear-gradient(90deg, rgba(217,119,6,0.08), transparent) !important; }

/* ------------------------------------------------
   Print Styles
   ------------------------------------------------ */
@media print {
  #sidebar,
  #topbar,
  .btn,
  .btn-group,
  .alert-dismissible .btn-close,
  nav,
  .no-print {
    display: none !important;
  }

  #main-content {
    margin-left: 0 !important;
  }

  .content-area {
    padding: 0 !important;
  }

  .card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .table { font-size: 11pt; }
  .badge { border: 1px solid #999 !important; color: #000 !important; background: none !important; }
}

/* ------------------------------------------------
   Mobile Responsive Tweaks
   ------------------------------------------------ */
@media (max-width: 575.98px) {
  .app-title { font-size: 1.6rem; }
  .glass-card { border-radius: 1rem; }
  .attendance-tabs .nav-link { font-size: 0.75rem; padding: 0.75rem 0.25rem; }
  .tab-content { padding: 1rem !important; }
}

/* ------------------------------------------------
   Scrollbar (admin sidebar already handles its own)
   ------------------------------------------------ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.35); }
