:root {
  --primary: #0ea968;
  --primary-dark: #087a4c;
  --primary-darker: #065c3a;
  --primary-light: #e6f8ef;
  --gold: #f0b429;
  --gold-dark: #d99a1b;
  --gold-light: #fef3d9;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --purple: #8b5cf6;
  --purple-dark: #7c3aed;
  --pink: #ec4899;
  --pink-dark: #db2777;
  --teal: #14b8a6;
  --teal-dark: #0d9488;
  --orange: #f97316;
  --orange-dark: #ea580c;
  --red: #ef4444;
  --red-dark: #dc2626;
  --bg: #f2f6f4;
  --text-dark: #1a2332;
  --sidebar-w: 264px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  margin: 0;
}

a { text-decoration: none; }

/* ===================== LAYOUT ===================== */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(195deg, var(--primary-darker), var(--primary) 70%);
  flex-shrink: 0;
  color: #fff;
}
.sidebar-body { display: flex; flex-direction: column; height: 100%; padding: 0; }

.sidebar-brand {
  align-items: center;
  gap: 12px;
  padding: 28px 24px 16px;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.2;
}
.sidebar-brand i { font-size: 1.8rem; color: var(--gold); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  margin-bottom: 8px;
}

.sidebar-section {
  padding: 14px 24px 6px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.5);
  font-weight: 600;
}

.sidebar-nav { padding: 4px 12px 24px; }
.sidebar-nav .nav-link {
  color: rgba(255,255,255,.88);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 3px;
  font-size: .93rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .15s ease;
}
.sidebar-nav .nav-link i {
  font-size: 1.05rem; width: 30px; height: 30px; text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12); border-radius: 9px; flex-shrink: 0;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.12); color: #fff; transform: translateX(2px); }
.sidebar-nav .nav-link.active {
  background: var(--gold);
  color: #2b2200;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(240,180,41,.4);
}
.sidebar-nav .nav-link.active i { background: rgba(43,34,0,.12); }

.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ===================== TOP APP HEADER ===================== */
.top-navbar {
  background: #fff;
  box-shadow: 0 2px 10px rgba(15,122,77,.06);
  padding: 10px 16px;
  min-height: 60px;
}
.btn-sidebar-toggle {
  border: none; background: transparent; color: var(--primary-dark);
  padding: 4px 8px; font-size: 1.35rem; line-height: 1; flex-shrink: 0;
}
.navbar-brand-mobile {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: .95rem;
  color: var(--primary-dark);
  white-space: nowrap;
  overflow: hidden;
  margin-left: 2px;
}
.brand-logo-circle {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(240,180,41,.4);
}
.page-heading { color: var(--primary-dark); font-weight: 700; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border: none;
  border-radius: 30px;
  padding: 3px 10px 3px 3px;
  font-weight: 500;
  font-size: .82rem;
  color: var(--primary-dark);
  flex-shrink: 0;
  white-space: nowrap;
  transition: transform .12s ease;
}
.user-chip:active { transform: scale(.95); }
.avatar-circle {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-darker));
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .82rem;
  flex-shrink: 0;
}
.avatar-lg { width: 46px; height: 46px; font-size: 1.3rem; }
.role-badge {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff; font-weight: 600;
  font-size: .68rem; padding: 3px 9px;
}

@media (max-width: 380px) {
  .navbar-brand-mobile .brand-text { display: none; }
  .user-chip span.d-none.d-md-inline { display: none !important; }
}

.page-content { padding: 20px; flex: 1; }
.page-footer {
  text-align: center;
  padding: 16px;
  color: #9ca3af;
  font-size: .82rem;
}

/* ===================== QURAN VERSE BANNER (compact) ===================== */
.quran-banner {
  background: linear-gradient(135deg, var(--gold-light) 0%, #fffdf7 55%, var(--primary-light) 130%);
  border: 1px solid rgba(240,180,41,.35);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  text-align: center;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.quran-banner::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius-md);
  padding: 1px;
  background: linear-gradient(135deg, var(--gold), transparent 40%, transparent 60%, var(--primary));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: .5;
}
.quran-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
  color: var(--gold-dark);
}
.quran-ornament::before, .quran-ornament::after {
  content: '';
  height: 1px;
  width: 22px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.quran-ornament::after { background: linear-gradient(90deg, var(--gold), transparent); }
.quran-ornament i { font-size: .72rem; }

.quran-arabic {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-darker);
  line-height: 1.5;
  direction: rtl;
  margin: 0 auto 4px;
  max-width: 520px;
}
.quran-translation {
  font-size: .88rem;
  color: var(--text-dark);
  font-style: italic;
  max-width: 460px;
  margin: 0 auto 3px;
  line-height: 1.35;
}
.quran-source {
  font-size: .62rem;
  color: var(--gold-dark);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .quran-arabic { font-size: 1.5rem; line-height: 1.45; }
  .quran-banner { padding: 10px 14px; }
}

/* ===================== BOTTOM NAVIGATION (mobile app style) ===================== */
.bottom-nav-spacer { height: 78px; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1040;
  background: #fff;
  border-top: 1px solid #eef2f0;
  box-shadow: 0 -6px 20px rgba(15,122,77,.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #9aa5a1;
  background: none;
  border: none;
  flex: 1;
  padding: 4px 2px;
  font-size: .68rem;
  font-weight: 600;
  transition: color .15s ease, transform .12s ease;
}
.bn-item:active { transform: scale(.92); }
.bn-icon { font-size: 1.25rem; line-height: 1; transition: transform .15s ease; }
.bn-label { line-height: 1; }
.bn-item.active { color: var(--primary); }
.bn-item.active .bn-icon { transform: translateY(-2px); }
.bn-item.active .bn-icon::after {
  content: '';
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
  margin: 4px auto 0;
}

.bn-fab-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: -30px;
}
.bn-fab {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 20px rgba(240,180,41,.5);
  border: 4px solid #fff;
  transition: transform .15s ease;
}
.bn-fab-link:active .bn-fab { transform: scale(.9); }

/* ===================== HERO BALANCE CARD (mobile-app style) ===================== */
.balance-hero {
  background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 60%, var(--teal) 130%);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  color: #fff;
  box-shadow: 0 14px 34px rgba(8,122,76,.32);
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}
.balance-hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.balance-hero::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -20px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.balance-hero .hero-label {
  font-size: .82rem;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.balance-hero .hero-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.balance-hero .hero-progress-track {
  height: 8px;
  background: rgba(255,255,255,.25);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}
.balance-hero .hero-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #fff2c7);
  border-radius: 20px;
}
.balance-hero .hero-meta {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  opacity: .9;
  position: relative;
  z-index: 1;
}
.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}
.hero-action-btn {
  flex: 1;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  color: #fff;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  font-weight: 600;
  transition: transform .12s ease, background .15s ease;
}
.hero-action-btn i { font-size: 1.15rem; }
.hero-action-btn:active { transform: scale(.94); background: rgba(255,255,255,.28); color: #fff; }

/* ===================== QUICK MENU GRID (app launcher style) ===================== */
.quick-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 8px;
  margin-bottom: 20px;
}
@media (min-width: 992px) {
  .quick-menu-grid { grid-template-columns: repeat(6, 1fr); }
}
.quick-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--text-dark);
  font-size: .72rem;
  font-weight: 600;
  text-align: center;
  transition: transform .12s ease;
}
.quick-menu-item:active { transform: scale(.93); }
.quick-menu-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}
.quick-menu-icon.c-green { background: linear-gradient(135deg, var(--primary), var(--primary-darker)); box-shadow: 0 6px 14px rgba(14,169,104,.35); }
.quick-menu-icon.c-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); box-shadow: 0 6px 14px rgba(240,180,41,.35); }
.quick-menu-icon.c-blue { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); box-shadow: 0 6px 14px rgba(59,130,246,.35); }
.quick-menu-icon.c-purple { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); box-shadow: 0 6px 14px rgba(139,92,246,.35); }
.quick-menu-icon.c-pink { background: linear-gradient(135deg, var(--pink), var(--pink-dark)); box-shadow: 0 6px 14px rgba(236,72,153,.35); }
.quick-menu-icon.c-teal { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); box-shadow: 0 6px 14px rgba(20,184,166,.35); }
.quick-menu-icon.c-orange { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); box-shadow: 0 6px 14px rgba(249,115,22,.35); }
.quick-menu-icon.c-red { background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 6px 14px rgba(239,68,68,.35); }
.quick-menu-icon.c-gray { background: linear-gradient(135deg, #64748b, #475569); box-shadow: 0 6px 14px rgba(100,116,139,.3); }

/* ===================== CARDS / WIDGETS ===================== */
.stat-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: 0 4px 16px rgba(15,122,77,.07);
  border: 1px solid #eef2f0;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:active { transform: scale(.98); }
.stat-icon {
  width: 50px; height: 50px;
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon.green { background: linear-gradient(135deg, var(--primary), var(--primary-darker)); box-shadow: 0 6px 14px rgba(14,169,104,.3); }
.stat-icon.gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); box-shadow: 0 6px 14px rgba(240,180,41,.3); }
.stat-icon.blue { background: linear-gradient(135deg, var(--blue), var(--blue-dark)); box-shadow: 0 6px 14px rgba(59,130,246,.3); }
.stat-icon.red { background: linear-gradient(135deg, var(--red), var(--red-dark)); box-shadow: 0 6px 14px rgba(239,68,68,.3); }
.stat-icon.purple { background: linear-gradient(135deg, var(--purple), var(--purple-dark)); box-shadow: 0 6px 14px rgba(139,92,246,.3); }
.stat-icon.teal { background: linear-gradient(135deg, var(--teal), var(--teal-dark)); box-shadow: 0 6px 14px rgba(20,184,166,.3); }
.stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text-dark); line-height: 1.2; }
.stat-label { color: #6b7280; font-size: .82rem; }

.content-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 4px 16px rgba(15,122,77,.06);
  border: 1px solid #eef2f0;
  margin-bottom: 20px;
}
.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.content-card-header h5 {
  font-weight: 700; color: var(--primary-dark); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.content-card-header h5 .header-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary-light); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.btn { border-radius: var(--radius-sm); font-weight: 500; transition: transform .1s ease; }
.btn:active { transform: scale(.96); }
.btn-success, .bg-success { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-success:hover { background-color: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.btn-outline-success { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-success:hover { background-color: var(--primary) !important; color: #fff !important; }
.text-success { color: var(--primary) !important; }

.table thead th {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border: none;
  white-space: nowrap;
}
.table td { vertical-align: middle; font-size: .9rem; }
.table-sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; }
.table thead .table-sticky-col { background: var(--primary-light); z-index: 3; }

.progress { height: 10px; border-radius: 20px; background: #e9ecef; }
.progress-bar { background: linear-gradient(90deg, var(--primary), var(--gold)); }

/* ===================== GALLERY ===================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.gallery-card {
  background: #fff;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15,122,77,.08);
  transition: transform .2s ease, box-shadow .2s ease;
  border: 1px solid #eef2f0;
}
.gallery-card:hover, .gallery-card:active { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(15,122,77,.16); }
.gallery-img-wrap { height: 190px; overflow: hidden; background: #f0f0f0; cursor: pointer; }
.gallery-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery-card:hover .gallery-img-wrap img { transform: scale(1.08); }
.gallery-body { padding: 14px 16px; }
.gallery-body h6 { font-weight: 700; margin-bottom: 4px; color: var(--text-dark); }
.gallery-body .meta { font-size: .78rem; color: #9ca3af; }

html, body { height: 100%; }

/* ===================== LOGIN ===================== */
.login-body {
  background: linear-gradient(160deg, var(--primary-darker) 0%, var(--primary) 45%, var(--teal) 100%);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: absolute; top: -80px; right: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.login-body::after {
  content: '';
  position: absolute; bottom: -100px; left: -60px;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.login-wrapper { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-card {
  background: #fff;
  border-radius: 28px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-logo-circle {
  width: 64px; height: 64px; font-size: 2rem;
  margin: 0 auto 10px;
  border-radius: 20px;
}
.login-brand h3 { font-weight: 800; color: var(--primary-dark); margin: 8px 0 2px; }
.login-brand p { color: #6b7280; font-size: .88rem; margin: 0; }

/* ===================== MISC ===================== */
.badge { font-weight: 500; padding: 5px 10px; border-radius: 8px; }
.photo-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 12px; }
.upload-preview { max-width: 100%; max-height: 220px; border-radius: 14px; margin-top: 10px; }
.form-label { font-weight: 500; font-size: .9rem; color: var(--text-dark); }
.form-control, .form-select { border-radius: var(--radius-sm); padding: 10px 14px; border-color: #dfe4e2; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(14,169,104,.15); }
.card-tab-btn.active { background: var(--primary); color: #fff; }

@media print {
  .sidebar, .top-navbar, .page-footer, .bottom-nav, .bottom-nav-spacer, .no-print { display: none !important; }
  .main-content { width: 100%; }
  .page-content { padding: 0; }
}

@media (max-width: 991.98px) {
  .page-content { padding: 14px; }
}
