/* ============================================================
   IQRA INSTITUTE — APP-FEEL v2  (phone)
   Linked with media="(max-width: 900px)" → desktop is untouched.
   Sits ON TOP of mobile-app.css / mobile-shell.css / mobile-student.css / mobile-staff.css.
   What it adds: card lists instead of wide tables, 2-column KPI tiles, back button + progress bar,
   readable type floor, thumb-size targets, install banner, calmer page-enter motion.
   ============================================================ */

:root {
  --av2-ink: #0f2e24;
  --av2-muted: #6b7a74;
  --av2-line: rgba(15, 46, 36, .10);
  --av2-card: #fff;
  --av2-gold: #c9a84c;
  --av2-r: 16px;
  --av2-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ───────── Base feel ───────── */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h, 56px) + 10px); }
body { -webkit-font-smoothing: antialiased; }

.mb-stab, .mb-tab, .sd-topbar, .topbar, .navbar-inner, .mb-sheet, .av2-install {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button, .btn, .sd-btn, a.btn, [role="button"] { -webkit-touch-callout: none; }
.btn:active, .sd-btn:active, button:not(:disabled):active { transform: scale(.975); transition: transform .08s; }

/* Readable tab-bar labels (were ~10.5px) */
.mb-stab, .mb-tab { font-size: .72rem !important; }
.mb-tab span, .mb-stab span { font-size: .72rem; }

/* ───────── Forms: 16px stops iOS zooming into a field; same height everywhere ───────── */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="color"]),
select, textarea { font-size: 16px !important; }

/* ───────── Thumb-size targets ───────── */
/* (this file loads before the page's own css, so these carry `html body` to win on equal specificity) */
/* min-height ONLY: an explicit min-width would switch off a flex item's automatic min-content width and let labels shrink/overlap */
html body .logout-btn, html body .btn-lib, html body .sal-btn, html body .ae-btn, html body .ul-link, html body .social-btn, html body .ta-snav-btn { min-height: 44px; }
html body .social-btn { width: 44px; height: 44px; }
html body footer a, html body .footer a, html body .footer-links a { min-height: 44px; display: inline-flex; align-items: center; }
html body .mb-sheet-list a { min-height: 44px; display: flex; align-items: center; }
html body .breadcrumb a { display: inline-flex; align-items: center; min-height: 40px; padding-inline: 2px; }
html body .contact-item a { display: inline-flex; align-items: center; min-height: 44px; }
html body .cat-pill { min-height: 40px; display: inline-flex; align-items: center; }
html body .post-card-arrow { width: 40px; height: 40px; }
.sd-sidebar a, .sidebar a, .sidebar button { min-height: 46px; }                    /* menu drawer rows incl. "Log out" */
/* native checkboxes / radios: big enough to hit (custom toggles keep their own size) */
input[type="checkbox"]:not(.toggle-input):not([class*="switch"]):not([class*="toggle"]),
input[type="radio"]:not([class*="switch"]):not([class*="toggle"]) { width: 22px; height: 22px; accent-color: var(--emerald-dark, #1a4a3a); flex: none; }
.main-content .btn, .main-content button, .sd-main .btn, .sd-main button { min-height: 44px; }
.main-content .btn-sm, .sd-main .btn-sm, .sd-btn-sm { min-height: 40px; }

/* ───────── KPI tiles: two per row (were one card per row, eating the screen) ───────── */
.stats-grid, .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; margin-bottom: 16px !important; }
.stats-grid .stat-card, .stat-cards .stat-card {
  flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 14px 12px !important; min-width: 0;
  border-radius: var(--av2-r); text-align: start;
}
.stats-grid .stat-icon, .stat-cards .stat-icon { width: 42px; height: 42px; border-radius: 12px; font-size: 1.05rem; flex: none; }
.stats-grid .stat-val, .stats-grid .stat-value, .stat-cards .stat-val, .stat-cards .stat-value, .stat-cards .stat-num { font-size: 1.55rem !important; line-height: 1.05; }
.stats-grid .stat-label, .stat-cards .stat-label { font-size: .78rem !important; line-height: 1.25; overflow-wrap: anywhere; }
.stats-grid .stat-card > div:not(.stat-icon), .stat-cards .stat-card > div:not(.stat-icon) { min-width: 0; width: 100%; }
/* an odd last tile spans the row instead of leaving a hole */
.stats-grid > .stat-card:last-child:nth-child(odd), .stat-cards > .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ───────── Tables → card lists (JS adds .av2-rt + data-label) ───────── */
table.av2-rt { display: block !important; width: 100% !important; max-width: 100% !important; overflow: visible !important; border: 0 !important; background: none !important; box-shadow: none !important; }
table.av2-rt thead { display: none !important; }
table.av2-rt tbody { display: block !important; }
table.av2-rt tbody tr {
  display: block !important; margin: 0 0 10px !important; padding: 4px 14px !important;
  border: 1px solid var(--av2-line) !important; border-radius: var(--av2-r) !important;
  box-shadow: 0 2px 10px rgba(15, 46, 36, .06); overflow: hidden;
}
:where(table.av2-rt tbody tr) { background-color: var(--av2-card); }
table.av2-rt tbody td {
  display: flex !important; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--av2-line) !important;
  white-space: normal !important; text-align: end !important; min-height: 44px;
  font-size: .92rem; overflow-wrap: anywhere; background: transparent !important;
}
table.av2-rt tbody td:last-child { border-bottom: 0 !important; }
table.av2-rt tbody td::before {
  content: attr(data-label); flex: 0 0 36%; max-width: 40%; text-align: start;
  font-weight: 700; font-size: .76rem; line-height: 1.25; color: var(--av2-muted);
}
table.av2-rt tbody td[data-label=""]::before { display: none; }
table.av2-rt tbody td:first-child { font-weight: 700; }
table.av2-rt tbody td.av2-empty { justify-content: center; text-align: center !important; color: var(--av2-muted); font-weight: 400; }
table.av2-rt tbody td.av2-empty::before { display: none; }
table.av2-rt tbody td.av2-act { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
table.av2-rt tbody td.av2-act::before { display: none; }
table.av2-rt tbody td:empty { display: none !important; }
table.av2-rt td .btn, table.av2-rt td button, table.av2-rt td a.btn { white-space: normal; }

/* ───────── Back button (inner pages) ───────── */
.av2-back {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 13px; margin-inline-end: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(15, 46, 36, .07); color: var(--av2-ink); cursor: pointer;
}
.av2-back svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.av2-back:active { background: rgba(15, 46, 36, .14); transform: scale(.94); }
/* the public site's bar is dark green */
.navbar-inner .av2-back { background: rgba(255, 255, 255, .14); color: #fff; margin-inline-start: 4px; }
.navbar-inner .av2-back:active { background: rgba(255, 255, 255, .26); }
.sd-topbar-left, .topbar-left, .navbar-inner { align-items: center; }

/* ───────── Navigation progress bar ───────── */
.av2-progress {
  position: fixed; inset-inline: 0; top: 0; height: 3px; z-index: 2000; pointer-events: none;
  background: linear-gradient(90deg, var(--av2-gold), #e9d28a); transform-origin: left center;
  transform: scaleX(0); opacity: 0; transition: transform .35s var(--av2-ease), opacity .25s;
}
[dir="rtl"] .av2-progress { transform-origin: right center; }
.av2-progress.on { opacity: 1; transform: scaleX(.72); transition: transform 4s cubic-bezier(.1, .6, .2, 1), opacity .1s; }

/* ───────── Install banner ───────── */
.av2-install {
  position: fixed; z-index: 1090; inset-inline: 10px;
  bottom: calc(var(--mb-tab-h, 0px) + env(safe-area-inset-bottom, 0px) + 10px);
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  background: rgba(255, 255, 255, .98); border: 1px solid var(--av2-line); border-radius: 18px;
  box-shadow: 0 14px 40px rgba(15, 46, 36, .22);
  transform: translateY(24px); opacity: 0; transition: transform .35s var(--av2-ease), opacity .3s;
}
.av2-install.show { transform: none; opacity: 1; }
.av2-install img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.av2-install .av2-i-txt { flex: 1; min-width: 0; line-height: 1.3; }
.av2-install .av2-i-txt b { display: block; font-size: .92rem; color: var(--av2-ink); }
.av2-install .av2-i-txt span { display: block; font-size: .78rem; color: var(--av2-muted); }
.av2-install .av2-i-go { flex: none; border: 0; border-radius: 12px; padding: 0 16px; min-height: 44px; font-weight: 700; font-size: .9rem; color: #fff; background: var(--av2-ink); }
.av2-install .av2-i-x { flex: none; width: 36px; height: 44px; border: 0; background: none; color: var(--av2-muted); font-size: 1.5rem; line-height: 1; }

/* ───────── Standalone (opened from the home screen) ───────── */
@media (display-mode: standalone) {
  .av2-install { display: none !important; }
  body { overscroll-behavior-y: contain; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .av2-progress, .av2-install { transition: none; }
  .btn:active, .sd-btn:active, button:not(:disabled):active { transform: none; }
}
