/* Digital Sarthi application UI: forms, alerts, tables, tiles, member and admin shells.
   Loaded after site.css. Colours only from brand.css. */

/* Forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow) }
.card-title { font: 800 1.2rem var(--f-display); margin: 0 0 .5rem }
.auth-card { max-width: 520px; margin: 32px auto }
.auth-card h1 { font-size: 2rem; margin-bottom: .4rem }
.field { margin-bottom: 16px }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 4px }
.help { font-size: .9rem; color: var(--muted); margin: 4px 0 0 }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 8px 12px; font: inherit; color: var(--ink); background: var(--card);
  border: 2px solid var(--line); border-radius: 12px }
textarea.input { min-height: 120px }
.input:focus { border-color: var(--teal); outline: none }
.input.input-validation-error { border-color: var(--rose) }
.field-validation-error, .validation-summary-errors { color: var(--rose); font-weight: 600; font-size: .92rem }
.validation-summary-errors ul { margin: 0; padding-left: 18px }
.validation-summary-valid { display: none }
.check { display: flex; gap: 10px; align-items: flex-start }
.check input { width: 22px; height: 22px; margin-top: 4px; flex: none; accent-color: var(--teal) }
.input-prefix { display: flex }
.input-prefix span { display: flex; align-items: center; padding: 0 12px; background: var(--ok-soft); color: var(--ink); border: 2px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; font-weight: 700 }
.input-prefix .input { border-radius: 0 12px 12px 0 }
.btn-link { all: unset; cursor: pointer; color: var(--teal-text); text-decoration: underline; font-weight: 600; font-size: .92rem }
.btn-link:focus-visible { outline: 3px solid var(--focus) }
.btn-sm { min-height: 38px; padding: 6px 16px; font-size: .95rem }
.btn-danger { background: var(--rose); color: var(--card) }
.divider { text-align: center; color: var(--muted); margin: 16px 0 0; font-size: .95rem }
.divider a, .auth-card a { color: var(--teal-text); font-weight: 600 }

/* Alerts: always strong contrast */
.alert { border: 1.5px solid; border-left-width: 6px; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-weight: 400 }
.alert a { color: inherit; font-weight: 700 }
.alert-success { background: var(--alert-ok-bg); color: var(--alert-ok-ink); border-color: var(--alert-ok-line) }
.alert-error { background: var(--alert-err-bg); color: var(--alert-err-ink); border-color: var(--alert-err-line) }
.alert-warning { background: var(--alert-warn-bg); color: var(--alert-warn-ink); border-color: var(--alert-warn-line) }
.alert-info { background: var(--alert-info-bg); color: var(--alert-info-ink); border-color: var(--alert-info-line) }
.disclosure a { color: inherit; font-weight: 700 }

/* Tiles, badges, tables */
.grid { display: grid; gap: 16px }
@media(min-width:640px) { .grid-2 { grid-template-columns: repeat(2, 1fr) } }
@media(min-width:900px) { .grid-3 { grid-template-columns: repeat(3, 1fr) } .grid-4 { grid-template-columns: repeat(4, 1fr) } }
.stat-tile { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px }
.stat-tile .label { color: var(--muted); font-size: .9rem; font-weight: 600 }
.stat-tile .value { font: 800 1.8rem/1.2 var(--f-display); color: var(--teal-text) }
.stat-tile .hint { font-size: .88rem; color: var(--muted) }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; border: 1px solid }
.badge-ok { background: var(--alert-ok-bg); color: var(--alert-ok-ink); border-color: var(--alert-ok-line) }
.badge-warn { background: var(--alert-warn-bg); color: var(--alert-warn-ink); border-color: var(--alert-warn-line) }
.badge-err { background: var(--alert-err-bg); color: var(--alert-err-ink); border-color: var(--alert-err-line) }
.badge-info { background: var(--alert-info-bg); color: var(--alert-info-ink); border-color: var(--alert-info-line) }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px }
.table { width: 100%; border-collapse: collapse; font-size: .93rem }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top }
.table th { background: var(--ok-soft); color: var(--ink); font-weight: 700; white-space: nowrap }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums }
.table a { color: var(--teal-text); font-weight: 600 }
.empty-state { text-align: center; padding: 32px 16px; background: var(--card); border: 2px dashed var(--line); border-radius: 18px }
.empty-state .icon { font-size: 2.2rem; line-height: 1; margin-bottom: 8px }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0 auto 16px }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center }
.row-between { justify-content: space-between }
.stack > * + * { margin-top: 16px }
.mt-4 { margin-top: 16px } .mt-6 { margin-top: 32px } .mb-0 { margin-bottom: 0 }
.muted { color: var(--muted) }
.text-center { text-align: center }
.progress { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden }
.progress > i { display: block; height: 100%; background: var(--teal); border-radius: 999px }
.progress.gold > i { background: var(--gold) }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: .9em }

/* Lesson player */
.player { position: relative; aspect-ratio: 16/9; background: var(--device); border-radius: 18px; overflow: hidden }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0 }
.test-player { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--on-band); padding: 16px }
.test-player .small { color: var(--on-band-muted) }
.watermark { position: absolute; top: 10%; left: 10%; pointer-events: none; color: var(--watermark); font: 700 .95rem var(--f-body); transition: top 1s, left 1s; white-space: nowrap; z-index: 2 }
.lesson-list { list-style: none; padding: 0 }
.crumbs-wrap { margin-bottom: 8px }
.qr { width: 200px; height: 200px; background: var(--card); padding: 8px; border-radius: 12px; border: 1px solid var(--line) }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px }
.copy-field { display: flex; gap: 8px }
.copy-field .input { flex: 1 }
.tree-level { font-weight: 700; color: var(--teal-text) }
.rank-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-weight: 700; font-size: .8rem }

/* App shell (member + admin) */
.app-body { padding-left: 0; padding-right: 0; padding-bottom: 0 }
.app-body .top { margin-inline: 0; padding-inline: 16px }
.app { display: flex; min-height: calc(100vh - 58px) }
.sidenav { display: none; width: 250px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 16px 8px }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600 }
.sidenav a:hover { background: var(--ok-soft) }
.sidenav a[aria-current="page"] { background: var(--band); color: var(--on-band) }
.sidenav .ico { width: 1.4em; text-align: center }
.sidenav .group { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 14px 4px; font-weight: 700 }
.app-main { flex: 1; min-width: 0; padding: 20px 16px 110px }
.app-main .page-title { margin-bottom: 20px; font-size: clamp(1.6rem, 4vw, 2.2rem) }
@media(min-width:900px) { .sidenav { display: block } .app-main { padding: 28px 32px 60px } }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 54; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom) }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: .75rem; font-weight: 700; color: var(--muted); text-decoration: none }
.bottomnav a .ico { font-size: 1.3rem; line-height: 1 }
.bottomnav a[aria-current="page"] { color: var(--teal-text) }
@media(min-width:900px) { .bottomnav { display: none } }
.app-body .float-actions { bottom: calc(72px + env(safe-area-inset-bottom, 0px)) }
@media(min-width:900px) { .app-body .float-actions { bottom: 16px } }
.who { font-weight: 600; font-size: .95rem; color: var(--on-band) }
.top .btn-line { color: var(--on-band) }

/* Admin */
.admin-mobile-menu { margin-bottom: 16px }
.admin-mobile-menu a { color: var(--teal-text); font-weight: 600 }
@media(min-width:900px) { .admin-mobile-menu { display: none } }
.counter { font-size: .85rem; color: var(--muted) }
.counter.over { color: var(--rose); font-weight: 700 }
.inline-form { display: inline }
.admin-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px }
.admin-filters .field { margin: 0 }
.pager { display: flex; gap: 8px; margin-top: 12px; align-items: center }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px }
.kv dt { font-weight: 700; color: var(--muted) }
.kv dd { margin: 0 }
.json { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; background: var(--ok-soft); color: var(--ink); padding: 10px; border-radius: 10px; max-height: 320px; overflow: auto }

/* Phase 6: micro-site, Promotion Kit, CRM */
.microsite { max-width: 760px }
.ms-hero { display: grid; gap: 18px }
.ms-who { display: flex; gap: 16px; align-items: center }
.ms-photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 4px solid var(--gold); flex: none }
.ms-initials { display: inline-grid; place-items: center; background: var(--band); color: var(--on-band); font: 700 2.2rem/1 "Baloo 2", system-ui, sans-serif }
.ms-quote { margin: 0; padding: 14px 18px; border-left: 5px solid var(--brand-orange); background: var(--paper); color: var(--ink); font-size: 1.1rem; border-radius: 0 12px 12px 0 }
.ticks { padding-left: 1.2rem }
.ticks li { margin: .35rem 0 }
.banner-card { margin: 0 }
.banner-preview { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: var(--band) }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) }
.unread { border-left: 4px solid var(--brand-orange) }

/* ===== Member LMS (Website Redesign §11): My Learning and the video page ===== */
.learn-head { display: flex; gap: 24px; align-items: center; flex-wrap: wrap }
.learn-head-text { flex: 1; min-width: 220px }
.ring { position: relative; width: 120px; height: 120px; flex: none }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg) }
.ring circle { fill: none; stroke-width: 12 }
.ring .ring-bg { stroke: var(--line) }
.ring .ring-fg { stroke: var(--gold); stroke-linecap: round }
.ring-n { position: absolute; inset: 0; display: grid; place-items: center; font: 800 1.6rem var(--f-display); color: var(--ink) }
.modules { display: grid; gap: 14px }
details.module { padding: 0; margin: 0 }
details.module > summary { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 18px 20px; font: inherit; cursor: pointer; list-style: none }
details.module > summary::after { display: none }
details.module > summary::-webkit-details-marker { display: none }
details.module > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 20px }
details.module > .muted, details.module > .video-cards { margin-inline: 20px }
.mod-title { font: 700 1.1rem var(--f-display); display: flex; gap: 10px; align-items: center }
.mod-n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-primary); color: var(--on-brand-primary); display: grid; place-items: center; font-size: .95rem }
.mod-meta { color: var(--muted); font-size: .95rem; white-space: nowrap }
.mod-bar { grid-column: 1 / -1; height: 8px }
.video-cards { list-style: none; padding: 0 0 18px; display: grid; gap: 10px }
.vc-link { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 64px }
.vc-link:hover { border-color: var(--teal) }
.vc-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px }
.vc-thumb { flex: none; width: 112px; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--brand-primary); display: grid; place-items: center }
.vc-thumb img { width: 100%; height: 100%; object-fit: cover }
.vc-no { color: var(--on-brand-primary); font: 800 1.4rem var(--f-display) }
.vc-body { display: flex; flex-direction: column; gap: 6px; min-width: 0 }
.vc-body b { font-weight: 700; line-height: 1.35 }
.vc-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.vc-bar { height: 6px; max-width: 220px }
.badge-new { background: var(--card); color: var(--ink); border-color: var(--ink) }
.is-locked .vc-link { background: var(--paper) }
@media (max-width: 480px) { .vc-thumb { width: 84px } .learn-head { justify-content: center; text-align: center } }
.mb-0 { margin-bottom: 0 }
.mb-6 { margin-bottom: 32px }
.nowrap { white-space: nowrap }
@media (max-width: 600px) { .player[data-test="1"] { aspect-ratio: auto; min-height: 220px } .player[data-test="1"] .test-player { position: relative; inset: auto; padding: 20px 16px } }
