/* ==========================================================================
   MARKAZ-UL-HUFFAZ — PARENT & STUDENT PORTAL STYLES (portal.css)
   Dedicated stylesheet for:
     - Parent Dashboard ("My Children")
     - Student Details & Enrolment Information
     - Qur'an Memorization & Recitation Progress UI (image1.jpeg replica)
   Primary Token:
     - Primary Green: #24474f (~60% visual hierarchy)
     - Accent Gold:   #ab8126
   ========================================================================== */

:root {
  --muh-primary: #24474f;
  --muh-primary-dark: #1a343a;
  --muh-primary-light: #f0f5f4;
  --muh-primary-tint: #e4eeec;
  --muh-gold: #ab8126;
  --muh-gold-dark: #8c671b;
  --muh-gold-light: #faf5ec;
  --muh-dark: #1d2e2e;
  --muh-white: #ffffff;
  --muh-bg: #f8faf9;
  --muh-text: #1a2527;
  --muh-text-muted: #536467;
  --muh-border: #dbe4e2;
  --muh-border-light: #edf2f1;
  --muh-danger: #dc2626;
  --muh-danger-bg: #fef2f2;
  --muh-warning: #d97706;
  --muh-warning-bg: #fffbeb;
  --muh-success: #16a34a;
  --muh-success-bg: #f0fdf4;
  --muh-font: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --muh-font-ar: 'Amiri', 'Traditional Arabic', serif;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.role-portal {
  font-family: var(--muh-font);
  background-color: #f8fbfb;
  color: var(--muh-text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==========================================================================
   PARENT PORTAL WATERMARK BACKGROUND
   Subtle school emblem watermark sitting faintly behind the page content
   ========================================================================== */
body.role-portal::before {
  content: "";
  position: fixed;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 540px;
  height: 540px;
  max-width: 85vw;
  max-height: 85vh;
  background: url("/static/images/brand/logo-bg.cf3f29b24899.jpeg") no-repeat center center;
  background-size: contain;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

/* When no children are present, watermark is slightly more prominent */
body.role-portal.has-no-children::before {
  opacity: 0.07;
}

/* ==========================================================================
   PORTAL NAVIGATION
   ========================================================================== */
.nav {
  background-color: var(--muh-dark);
  color: #ffffff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
}

.nav-brand-img {
  height: 42px;
  width: auto;
  max-width: 250px;
  object-fit: contain;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.nav-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(36, 71, 79, 0.4);
  color: #bbf7d0;
  border: 1px solid rgba(187, 247, 208, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: #ffffff;
  background: var(--muh-primary);
}

.nav-user {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.75);
  margin-left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.nav-user strong {
  color: #ffffff;
}

.nav-logout-btn {
  color: #fca5a5;
  text-decoration: none;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(252, 165, 165, 0.3);
  font-size: 0.75rem;
  transition: all 0.15s ease;
}

.nav-logout-btn:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #ffffff;
}

/* ==========================================================================
   PORTAL LAYOUT & CONTAINERS
   ========================================================================== */
.container {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

.page-header {
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--muh-border);
  padding-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--muh-primary-dark);
  letter-spacing: -0.01em;
}

.page-subtitle {
  color: var(--muh-text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.breadcrumb {
  font-size: 0.8125rem;
  color: var(--muh-text-muted);
  margin-bottom: 0.5rem;
}

.breadcrumb a {
  color: var(--muh-primary);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 0.4rem;
  opacity: 0.5;
}

/* ==========================================================================
   PORTAL CARDS & SURFACES
   Solid white surface ensures child information is 100% readable
   ========================================================================== */
.card {
  background: var(--muh-white);
  border: 1px solid var(--muh-border);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(36, 71, 79, 0.05);
  position: relative;
  z-index: 1;
}

.card-header {
  background: var(--muh-primary-light);
  border-bottom: 1px solid var(--muh-border);
  border-left: 4px solid var(--muh-primary);
  padding: 0.85rem 1.25rem;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--muh-primary-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 1.5rem;
}

/* Fields Table */
.fields {
  width: 100%;
  border-collapse: collapse;
}

.fields td {
  padding: 0.55rem 0.75rem;
  vertical-align: top;
  border-bottom: 1px solid var(--muh-border-light);
}

.fields tr:last-child td {
  border-bottom: none;
}

.fields td:first-child {
  font-weight: 600;
  color: var(--muh-text-muted);
  width: 180px;
  white-space: nowrap;
}

.fields td:last-child {
  color: var(--muh-text);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.15rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--muh-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--muh-primary-dark);
  box-shadow: 0 4px 12px rgba(36, 71, 79, 0.2);
}

.btn-secondary {
  background-color: var(--muh-white);
  color: var(--muh-text);
  border-color: var(--muh-border);
}

.btn-secondary:hover {
  background-color: #f1f5f4;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-active {
  background: var(--muh-success-bg);
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-completed {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-suspended {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Alerts & Messages */
.alert {
  padding: 0.85rem 1.15rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert-warning {
  background: var(--muh-warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: var(--muh-primary-light);
  color: var(--muh-primary-dark);
  border: 1px solid var(--muh-border);
}

.alert-success {
  background: var(--muh-success-bg);
  color: #15803d;
  border: 1px solid #bbf7d0;
}


/* ==========================================================================
   PROGRESS TRACKING UI — FAITHFUL RECREATION OF CLIENT REFERENCE (image1.jpeg)
   ========================================================================== */

/* Section Title with Ornamental Lines */
.mem-section-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--muh-primary-dark);
  letter-spacing: 0.04em;
  margin: 0 0 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.mem-section-title::before,
.mem-section-title::after {
  content: "";
  flex: 1;
  max-width: 140px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c4a76c, #ab8126);
}

.mem-section-title::after {
  background: linear-gradient(90deg, #ab8126, #c4a76c, transparent);
}

.mem-section-title span.ornament {
  color: #ab8126;
  font-size: 0.75rem;
}

/* Main Top Card: Capsule Progress Bar Card */
.mem-hero-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.75rem 2.25rem;
  box-shadow: 0 4px 20px rgba(36, 71, 79, 0.06);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
}

.mem-stat-col {
  min-width: 110px;
}

.mem-stat-col.col-left {
  text-align: left;
}

.mem-stat-col.col-right {
  text-align: right;
}

.mem-stat-badge-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muh-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.2rem;
}

.mem-stat-col.col-right .mem-stat-badge-label {
  color: #64748b;
}

.mem-stat-val {
  font-size: 2.25rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
  font-family: var(--muh-font);
}

.mem-stat-col.col-right .mem-stat-val {
  color: #475569;
}

.mem-stat-sub {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Capsule Progress Bar Container */
.mem-capsule-wrap {
  flex: 1;
  position: relative;
  padding: 0.5rem 0;
}

.mem-capsule-track {
  height: 42px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  position: relative;
  overflow: visible;
}

.mem-capsule-fill {
  height: 100%;
  width: var(--progress-width);
  background: linear-gradient(90deg, #1b6b3a 0%, #24474f 100%);
  border-radius: 9999px;
  position: relative;
  min-width: 16px;
  max-width: 100%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Open Qur'an Badge at Split Boundary */
.mem-split-badge {
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: #ffffff;
  border: 2px solid #24474f;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 3;
}

.mem-split-badge svg {
  width: 18px;
  height: 18px;
  fill: #24474f;
}

/* Middle Row: Completed & Remaining Portion Cards */
.mem-portion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.mem-portion-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(36, 71, 79, 0.04);
}

.mem-portion-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.mem-portion-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mem-portion-icon.icon-green {
  background: #1b6b3a;
  color: #ffffff;
}

.mem-portion-icon.icon-gray {
  background: #64748b;
  color: #ffffff;
}

.mem-portion-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.mem-portion-title-group h4 {
  font-size: 0.8125rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
  color: #0f172a;
}

.mem-portion-title-group p {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0.2rem 0 0;
}

/* Timeline Range Visualizer */
.mem-range-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.5rem 0.25rem;
  position: relative;
}

.mem-timeline-surah {
  text-align: center;
}

.mem-surah-ar {
  font-family: var(--muh-font-ar);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.mem-surah-num {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.15rem;
}

.mem-surah-note {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.1rem;
}

.mem-timeline-connector {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0 1rem;
}

.mem-timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: #e2e8f0;
  z-index: 1;
}

.mem-timeline-line.line-dotted {
  background: repeating-linear-gradient(90deg, #94a3b8, #94a3b8 4px, transparent 4px, transparent 8px);
  height: 2px;
}

.mem-to-badge {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #ffffff;
}

.mem-to-badge.to-green {
  background: #1b6b3a;
}

.mem-to-badge.to-gray {
  background: #64748b;
}

/* Bottom Row: 3 Stat Badges */
.mem-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.mem-stat-pill-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(36, 71, 79, 0.04);
}

.mem-stat-pill-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f0fdf4;
  color: #1b6b3a;
  border: 1px solid #bbf7d0;
}

.mem-stat-pill-icon.icon-book {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.mem-stat-pill-icon.icon-list {
  background: #f0fdf4;
  color: #1b6b3a;
  border: 1px solid #bbf7d0;
}

.mem-stat-pill-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.mem-stat-pill-data .sp-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.mem-stat-pill-data .sp-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.1;
}

.mem-stat-pill-data .sp-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.15rem;
}

/* Evaluation Chips & Remarks */
.eval-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.eval-chip-card {
  background: #f8fbfb;
  border: 1px solid var(--muh-border-light);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.eval-chip-card .ec-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muh-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.eval-chip-card .ec-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--muh-primary-dark);
}

.remarks-callout {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  color: var(--muh-text);
  line-height: 1.6;
  font-size: 0.9rem;
}

/* History Observation Table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

/* History table mobile scroll */
.history-table-scroll-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.history-table th {
  background: var(--muh-primary-light);
  color: var(--muh-primary-dark);
  font-weight: 700;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 2px solid var(--muh-border);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--muh-border-light);
}

.progress-history-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.progress-history-body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.progress-history-card .history-table-scroll-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.progress-history-card .history-table {
  min-width: 900px;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .mem-hero-card {
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    gap: 1.25rem;
  }

  .mem-stat-col {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .mem-stat-col.col-right {
    text-align: left;
  }

  .mem-portion-grid {
    grid-template-columns: 1fr;
  }

  .mem-stats-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .nav {
    flex-wrap: nowrap;
    height: 60px;
    padding: 0 1rem;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
  }

  .container {
    padding: 1rem;
  }
}