:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --primary: #059669;
  --primary-dark: #047857;
  --primary-soft: #ECFDF5;
  --sky: #0284C7;
  --sky-soft: #E0F2FE;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

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

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(at 8% 12%, rgba(5, 150, 105, 0.10) 0px, transparent 48%),
    radial-gradient(at 92% 10%, rgba(2, 132, 199, 0.11) 0px, transparent 46%),
    radial-gradient(at 80% 88%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 15% 85%, rgba(16, 185, 129, 0.08) 0px, transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 272px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  overflow-y: auto;
  transition: transform 0.22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--primary-soft);
}

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

.sidebar-brand .brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.nav-accordion {
  margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.65);
  border: 1px solid rgba(226, 232, 240, 0.75);
  padding: 4px;
}

.nav-acc-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-acc-header:hover {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-dark);
}

.nav-acc-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-acc-title svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.nav-acc-chevron {
  width: 15px;
  height: 15px;
  transition: transform 0.22s ease;
  color: var(--muted);
}

.nav-accordion.open .nav-acc-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.nav-acc-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s ease;
}

.nav-accordion.open .nav-acc-body {
  grid-template-rows: 1fr;
}

.nav-acc-inner {
  overflow: hidden;
  padding-top: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  color: #334155;
  font-weight: 500;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.nav-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.78;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary);
  text-decoration: none;
  transform: translateX(2px);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.14), rgba(2, 132, 199, 0.10));
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-link.active svg {
  opacity: 1;
  color: var(--primary);
}

.main-area {
  flex: 1;
  margin-left: 264px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 76px;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

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

.user-chip {
  text-align: right;
  font-size: 13px;
}

.user-chip .name { font-weight: 600; color: var(--text); }
.user-chip .role { font-size: 11px; color: var(--muted); }

.content-wrap {
  padding: 20px 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* Cards & Grids */
.card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  margin-bottom: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.stat-value { font-size: 24px; font-weight: 800; margin-top: 6px; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}
.btn:hover { text-decoration: none; opacity: 0.94; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sky { background: var(--sky); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-wa { background: #16A34A; color: #fff; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--success-soft); color: #15803D; }
.badge-danger { background: var(--danger-soft); color: #B91C1C; }
.badge-sky { background: var(--sky-soft); color: #0369A1; }
.badge-neutral { background: #F1F5F9; color: #475569; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-soft); color: #166534; border-color: #BBF7D0; }
.alert-error { background: var(--danger-soft); color: #991B1B; border-color: #FECACA; }

/* Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #F8FAFC;
  font-weight: 700;
}

.avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #F1F5F9;
}

.avatar-lg {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--border);
  background: #F1F5F9;
}

/* Guest / Auth Pages */
.guest-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, #ECFDF5 0%, #F8FAFC 55%, #E0F2FE 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.register-card {
  max-width: 720px;
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.07);
  z-index: 45;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}

.mobile-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  padding: 2px 4px;
  text-decoration: none;
  transition: color 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav a:hover {
  text-decoration: none;
  color: var(--primary);
}

.mobile-bottom-nav a:active {
  transform: scale(0.94);
}

.mobile-bottom-nav .nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 30px;
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-bottom-nav .nav-icon svg {
  width: 20px;
  height: 20px;
}

.mobile-bottom-nav a.active {
  color: var(--primary-dark);
  font-weight: 700;
}

.mobile-bottom-nav a.active .nav-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 35;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .main-area { margin-left: 0; padding-bottom: 84px; }
  .menu-toggle { display: inline-flex; }
  .content-wrap { padding: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .mobile-bottom-nav { display: flex; }
  .topbar { padding: 10px 14px; }
}

/* ==========================================================================
   GLASSMORPHISM & VIRAL DASHBOARD COMPONENTS (DETAIL SANTRI & USTADZ)
   ========================================================================== */
.glass-hero {
  position: relative;
  border-radius: 22px;
  padding: 26px 24px;
  color: #FFFFFF;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 16px 36px rgba(5, 150, 105, 0.18);
}

.glass-hero-emerald {
  background: linear-gradient(135deg, #059669 0%, #0D9488 48%, #0284C7 100%);
}

.glass-hero-indigo {
  background: linear-gradient(135deg, #0284C7 0%, #4F46E5 55%, #7C3AED 100%);
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.18);
}

.glass-hero::before,
.glass-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.glass-hero::before {
  width: 210px;
  height: 210px;
  top: -70px;
  right: -45px;
}

.glass-hero::after {
  width: 140px;
  height: 140px;
  bottom: -55px;
  left: 25%;
  background: rgba(255, 255, 255, 0.09);
}

.glass-hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.glass-profile-main {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.glass-avatar-ring {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  flex-shrink: 0;
}

.glass-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  object-fit: cover;
  background: #FFFFFF;
}

.glass-initials {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
}

.glass-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.glass-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #FFFFFF;
}

.glass-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.20);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #FFFFFF;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.32);
  text-decoration: none;
  transform: translateY(-1px);
}

.glass-btn-solid {
  background: #FFFFFF;
  color: #047857;
  border-color: #FFFFFF;
}

.glass-btn-solid:hover {
  background: #ECFDF5;
  color: #065F46;
}

.glass-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.glass-info-item {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.glass-info-item .label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.glass-info-item .val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.glass-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.glass-timeline-item {
  position: relative;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid #E2E8F0;
  border-left: 4px solid #059669;
  transition: transform 0.15s ease;
}

.glass-timeline-item:hover {
  transform: translateX(2px);
}

.glass-timeline-item.accent-sky { border-left-color: #0284C7; }
.glass-timeline-item.accent-indigo { border-left-color: #6366F1; }

.glass-ustadz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.glass-ustadz-card {
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.glass-ustadz-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.ustadz-avatar-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #059669, #0284C7);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* Pagination */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s ease;
}

.page-btn:hover:not(.disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.page-btn.disabled {
  opacity: 0.45;
  cursor: default;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--muted);
  font-weight: 700;
}
