/* ============================================================
   BAHRUL ULUM - FITUR TAMBAHAN CSS
   8 Fitur Baru: Slider, Guru, Kalender, Testimoni,
   Download, Statistik, Popup, Dark Mode
   ============================================================ */

/* ========================
   DARK MODE
   ======================== */
:root {
  --dm-bg: #0f172a;
  --dm-surface: #1e293b;
  --dm-surface2: #334155;
  --dm-border: #334155;
  --dm-text: #e2e8f0;
  --dm-muted: #94a3b8;
  --dm-card: #1e293b;
  color-scheme: light dark;
}

body.dark-mode {
  background: var(--dm-bg);
  color: var(--dm-text);
}

body.dark-mode .navbar,
body.dark-mode .bottom-nav,
body.dark-mode .mobile-drawer {
  background: var(--dm-surface);
  border-color: var(--dm-border);
}

body.dark-mode .navbar { box-shadow: 0 2px 20px rgba(0,0,0,.4); }
body.dark-mode .logo-text .name { color: #e2e8f0; }
body.dark-mode .navbar-menu a { color: #94a3b8; }
body.dark-mode .navbar-menu a:hover,
body.dark-mode .navbar-menu a.active { background: rgba(255,255,255,.07); color: #e2e8f0; }
body.dark-mode .dropdown-menu { background: var(--dm-surface); border-color: var(--dm-border); }
body.dark-mode .hamburger span { background: #e2e8f0; }
body.dark-mode .bottom-nav-item { color: var(--dm-muted); }
body.dark-mode .bottom-nav-item.active { color: #66bb6a; }
body.dark-mode .bottom-nav-item.active .bottom-nav-icon { background: rgba(102,187,106,.12); }

body.dark-mode .section-light { background: var(--dm-surface); }
body.dark-mode .section-alt { background: var(--dm-bg); }

body.dark-mode .school-card,
body.dark-mode .news-card,
body.dark-mode .stat-card,
body.dark-mode .event-item,
body.dark-mode .form-card,
body.dark-mode .ppdb-card,
body.dark-mode .unit-info-card,
body.dark-mode .contact-info-item { background: var(--dm-card); border-color: var(--dm-border); }

body.dark-mode .school-card-name,
body.dark-mode .news-card-title,
body.dark-mode .event-title,
body.dark-mode .section-title,
body.dark-mode .form-title { color: var(--dm-text); }

body.dark-mode .school-card-desc,
body.dark-mode .news-card-excerpt,
body.dark-mode .section-desc,
body.dark-mode .text-muted { color: var(--dm-muted); }

body.dark-mode .school-card-footer,
body.dark-mode .news-card-footer { border-color: var(--dm-border); }

body.dark-mode .school-card-stats { border-color: var(--dm-border); }

body.dark-mode .form-control,
body.dark-mode .form-select {
  background: var(--dm-surface2);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  border-color: #66bb6a;
  box-shadow: 0 0 0 3px rgba(102,187,106,.15);
}

body.dark-mode .form-control::placeholder { color: var(--dm-muted); }
body.dark-mode .form-label { color: #cbd5e1; }

body.dark-mode .footer { background: #060d1a; }
body.dark-mode .footer-bottom { border-color: rgba(255,255,255,.06); }

body.dark-mode .page-banner { background: linear-gradient(135deg,#060d1a,#0f3a19); }

body.dark-mode .news-date,
body.dark-mode .news-views { color: var(--dm-muted); }

body.dark-mode .stat-label { color: var(--dm-muted); }
body.dark-mode .stat-value { color: #66bb6a; }

body.dark-mode .filter-tab {
  background: var(--dm-surface2);
  border-color: var(--dm-border);
  color: var(--dm-muted);
}
body.dark-mode .filter-tab:hover,
body.dark-mode .filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

body.dark-mode .admin-card,
body.dark-mode .admin-stat-card { background: var(--dm-card) !important; border-color: var(--dm-border) !important; }

/* Dark mode toggle button */
.dark-mode-toggle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--gray-200);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--gray-600);
  transition: var(--transition);
  flex-shrink: 0;
}
.dark-mode-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--accent); }
body.dark-mode .dark-mode-toggle { border-color: var(--dm-border); color: #fbbf24; background: rgba(251,191,36,.1); }

/* ========================
   HERO SLIDER / CAROUSEL
   ======================== */
.hero-slider {
  position: relative;
  overflow: hidden;
}

.slide {
  display: none;
  position: relative;
  padding: 70px 0 90px;
  overflow: hidden;
  transition: opacity 0.6s ease;
}

.slide.active {
  display: block;
  animation: slideIn 0.7s ease;
}

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

/* Slider controls */
.slider-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,.4);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

.slider-dot.active {
  width: 28px;
  background: var(--secondary-light);
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.3);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: var(--transition);
  backdrop-filter: blur(6px);
}

.slider-arrow:hover { background: rgba(255,255,255,.3); }
.slider-arrow.prev { left: 20px; }
.slider-arrow.next { right: 20px; }

@media (max-width:640px) { .slider-arrow { display: none; } }

.slider-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--secondary-light);
  width: 0;
  transition: width linear;
}

/* ========================
   GURU & STAF
   ======================== */
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.teacher-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  text-align: center;
}

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

.teacher-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 24px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  position: relative;
}

.teacher-avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid var(--gray-200);
}

.teacher-card:hover .teacher-avatar::after { border-color: var(--primary); }

.teacher-body { padding: 16px 16px 20px; }
.teacher-name { font-size: .9rem; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; line-height: 1.3; }
.teacher-position { font-size: .75rem; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.teacher-subject { font-size: .72rem; color: var(--gray-400); }

body.dark-mode .teacher-card { background: var(--dm-card); border-color: var(--dm-border); }
body.dark-mode .teacher-name { color: var(--dm-text); }

/* ========================
   KALENDER AKADEMIK
   ======================== */
.calendar-wrap {
  background: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}

.calendar-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-nav-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,.2);
  border: none; cursor: pointer; color: white;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.calendar-nav-btn:hover { background: rgba(255,255,255,.3); }

.calendar-title { font-size: 1rem; font-weight: 800; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-day-name {
  padding: 10px 4px;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  border-bottom: 1px solid var(--gray-100);
}

.calendar-day {
  min-height: 60px;
  padding: 6px;
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  position: relative;
  cursor: default;
  transition: var(--transition);
}

.calendar-day:nth-child(7n) { border-right: none; }

.calendar-day:hover { background: var(--accent); }

.calendar-day-num {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  margin-bottom: 2px;
}

.calendar-day.today .calendar-day-num {
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.calendar-day.has-event .calendar-day-num { font-weight: 800; }

.calendar-day.other-month .calendar-day-num { color: var(--gray-300); }

.cal-event-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
  margin: 1px;
}

.cal-event-label {
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  color: white;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 1px;
  line-height: 1.5;
}

/* Calendar legend list */
.cal-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--gray-600); }
.cal-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Calendar upcoming list */
.cal-event-list { display: flex; flex-direction: column; gap: 8px; }
.cal-event-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--gray-50);
  border-left: 3px solid;
  font-size: .83rem;
}

body.dark-mode .calendar-wrap { background: var(--dm-card); border-color: var(--dm-border); }
body.dark-mode .calendar-day-name { color: var(--dm-muted); border-color: var(--dm-border); }
body.dark-mode .calendar-day { border-color: var(--dm-border); }
body.dark-mode .calendar-day:hover { background: rgba(255,255,255,.04); }
body.dark-mode .calendar-day-num { color: var(--dm-text); }
body.dark-mode .calendar-day.other-month .calendar-day-num { color: var(--dm-border); }
body.dark-mode .cal-event-item { background: var(--dm-surface2); }

/* ========================
   TESTIMONI
   ======================== */
.testimonial-slider-wrap { position: relative; overflow: hidden; }

.testimonial-track {
  display: flex;
  gap: 20px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.testimonial-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-200);
  min-width: calc(33.333% - 14px);
  flex-shrink: 0;
  position: relative;
  transition: var(--transition);
}

@media (max-width:1024px) { .testimonial-card { min-width: calc(50% - 10px); } }
@media (max-width:640px)  { .testimonial-card { min-width: 100%; } }

.testimonial-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); }

.testimonial-quote {
  font-size: 3rem;
  color: var(--primary);
  opacity: .15;
  line-height: 1;
  font-family: Georgia, serif;
  margin-bottom: -10px;
}

.testimonial-text {
  font-size: .88rem;
  color: var(--gray-600);
  line-height: 1.75;
  margin-bottom: 20px;
  font-style: italic;
}

.testimonial-author { display: flex; align-items: center; gap: 12px; }

.testimonial-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: white; flex-shrink: 0;
}

.testimonial-name { font-size: .88rem; font-weight: 800; color: var(--gray-900); }
.testimonial-role { font-size: .72rem; color: var(--gray-400); }

.testimonial-stars { display: flex; gap: 2px; margin-bottom: 12px; }
.testimonial-stars i { color: #fbbf24; font-size: .8rem; }

.testimonial-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.testi-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.testi-btn:hover { border-color: var(--primary); color: var(--primary); }

.testi-dots { display: flex; gap: 6px; }
.testi-dot {
  width: 8px; height: 8px;
  border-radius: 4px;
  background: var(--gray-300);
  border: none; cursor: pointer;
  transition: all 0.3s ease; padding: 0;
}
.testi-dot.active { width: 24px; background: var(--primary); }

body.dark-mode .testimonial-card { background: var(--dm-card); border-color: var(--dm-border); }
body.dark-mode .testimonial-text { color: var(--dm-muted); }
body.dark-mode .testimonial-name { color: var(--dm-text); }
body.dark-mode .testi-btn { background: var(--dm-surface2); border-color: var(--dm-border); color: var(--dm-muted); }
body.dark-mode .testi-dot { background: var(--dm-border); }

/* ========================
   DOWNLOAD CENTER
   ======================== */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.download-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.download-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.download-icon {
  width: 48px; height: 48px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.download-info { flex: 1; min-width: 0; }
.download-title {
  font-size: .87rem; font-weight: 700;
  color: var(--gray-900); margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.download-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: .72rem; color: var(--gray-400);
}
.download-type-badge {
  padding: 1px 8px;
  border-radius: 4px;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase;
}

.download-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}
.download-btn:hover { background: var(--primary); color: white; transform: scale(1.08); }

body.dark-mode .download-card { background: var(--dm-card); border-color: var(--dm-border); }
body.dark-mode .download-title { color: var(--dm-text); }

/* ========================
   STATISTIK PENGUNJUNG
   ======================== */
.stats-chart-wrap {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 24px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  padding-top: 10px;
}

.mini-bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: all 0.4s ease;
  cursor: default;
  position: relative;
}

.mini-bar:hover { opacity: .8; }
.mini-bar:hover::before {
  content: attr(data-val);
  position: absolute;
  top: -22px; left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800); color: white;
  font-size: .65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  white-space: nowrap;
}

.visitor-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

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

.visitor-stat {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--gray-200);
}

.visitor-stat-val { font-size: 1.4rem; font-weight: 800; color: var(--primary); line-height: 1; }
.visitor-stat-label { font-size: .72rem; color: var(--gray-400); margin-top: 3px; }

body.dark-mode .stats-chart-wrap,
body.dark-mode .visitor-stat { background: var(--dm-card); border-color: var(--dm-border); }
body.dark-mode .visitor-stat { background: var(--dm-surface2); }
body.dark-mode .visitor-stat-val { color: #66bb6a; }

/* ========================
   POPUP NOTIFIKASI
   ======================== */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s ease;
  backdrop-filter: blur(4px);
}

.popup-overlay.show {
  opacity: 1;
  visibility: visible;
}

.popup-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.popup-overlay.show .popup-box {
  transform: scale(1) translateY(0);
}

.popup-header {
  padding: 24px 24px 0;
  display: flex;
  justify-content: flex-end;
}

.popup-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); font-size: .9rem;
  transition: var(--transition);
}
.popup-close:hover { background: var(--gray-200); color: var(--gray-800); }

.popup-body { padding: 8px 28px 28px; text-align: center; }

.popup-emoji { font-size: 3rem; margin-bottom: 12px; }

.popup-title {
  font-size: 1.2rem; font-weight: 800;
  color: var(--primary); margin-bottom: 10px;
  line-height: 1.3;
}

.popup-text {
  font-size: .88rem; color: var(--gray-600);
  line-height: 1.7; margin-bottom: 20px;
}

.popup-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.popup-btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; padding: 10px 22px;
  border-radius: var(--radius-full);
  font-size: .85rem; font-weight: 700;
  text-decoration: none; transition: var(--transition);
  box-shadow: 0 4px 14px rgba(26,92,42,.35);
}
.popup-btn-primary:hover { transform: translateY(-1px); }

.popup-btn-dismiss {
  background: none; border: none;
  color: var(--gray-400); font-size: .8rem;
  cursor: pointer; text-decoration: underline;
  font-family: var(--font-main);
  padding: 4px;
}

body.dark-mode .popup-box { background: var(--dm-card); }
body.dark-mode .popup-title { color: #66bb6a; }
body.dark-mode .popup-text { color: var(--dm-muted); }
body.dark-mode .popup-close { background: var(--dm-surface2); color: var(--dm-muted); }

/* ========================
   PAGE: GURU & STAF
   ======================== */
.staff-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

/* ========================
   PAGE: DOWNLOAD
   ======================== */
.download-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

/* ========================
   VISITOR BADGE (public)
   ======================== */
.visitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid rgba(26,92,42,.15);
}

body.dark-mode .visitor-badge { background: rgba(102,187,106,.1); color: #66bb6a; border-color: rgba(102,187,106,.2); }

/* ========================
   ADMIN STAT CHARTS
   ======================== */
.admin-chart-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.admin-chart-label { font-size: .78rem; color: #64748b; width: 100px; flex-shrink: 0; text-align: right; }
.admin-chart-track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.admin-chart-fill { height: 100%; border-radius: 4px; transition: width 1s ease; }
.admin-chart-val { font-size: .75rem; font-weight: 700; color: #475569; width: 30px; }

/* ========================
   SMOOTH SCROLL FIX
   ======================== */
.hero-slider .hero-inner { animation: none; }
