/* ═══════════════════════════════════════════════════════════════
   TOUCH THE SKIES LMS — app styles
   Layered on top of styles.css (same file as the marketing site, so
   the tokens, type scale and gradient are identical by construction).
   Only app-shell / course / player / admin pieces live here.
   ═══════════════════════════════════════════════════════════════ */

/* ── buttons ─────────────────────────────────────────────────────
   styles.css sizes buttons for a landing page: 0.9rem/1.6rem padding,
   12px radius, a 20px drop shadow and an arrow that slides on hover.
   That reads as "click me" above the fold and as noise in a table row.
   App surfaces get a denser, quieter scale.

   .ic is already width:1em, so icons track the button's font-size —
   never hard-code icon pixel sizes inside a button.                    */

/* The app default size. Scoped selectors (0,2,0) outrank a bare .btn-sm
   (0,1,0), so this deliberately does NOT match when a size modifier is
   present — otherwise the base would silently win and every button would
   render the same height. Add any new size class to this list. */
.app-main  .btn:not(.btn-sm):not(.btn-xs):not(.btn-icon):not(.btn-lg):not(.btn-xl),
.auth-card .btn:not(.btn-sm):not(.btn-xs):not(.btn-icon):not(.btn-lg):not(.btn-xl),
.modal-card .btn:not(.btn-sm):not(.btn-xs):not(.btn-icon):not(.btn-lg):not(.btn-xl) {
  font-size: .9rem;
  padding: .62rem 1.15rem;
  border-radius: 10px;
}

.app-main .btn, .auth-card .btn, .modal-card .btn { box-shadow: none; }
.app-main .btn-primary,
.modal-card .btn-primary { background: var(--ink); box-shadow: none; }
.app-main .btn-primary:hover,
.modal-card .btn-primary:hover {
  background: var(--navy-2); filter: none;
  box-shadow: 0 2px 10px rgba(10, 18, 48, .14);
}
/* the arrow-slide flourish belongs on marketing CTAs, not on Save */
.app-main .btn:hover svg,
.modal-card .btn:hover svg { transform: none; }

.btn-sm { font-size: .82rem; padding: .44rem .85rem; border-radius: 8px; gap: .35rem; }
.btn-xs { font-size: .76rem; padding: .3rem .62rem; border-radius: 7px; gap: .3rem; }

/* square icon-only buttons — width comes from the padding box, not a hack */
.btn-icon { padding: .55rem; aspect-ratio: 1; border-radius: 9px; }
.btn-icon.btn-sm { padding: .42rem; }

/* lowest emphasis: no chrome until you touch it (Linear/Clay pattern) */
.btn-quiet {
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
}
.btn-quiet:hover { background: var(--bg-2); color: var(--ink); border-color: var(--line); }

.btn-danger { background: #fff; color: #B91C1C; border: 1px solid #FECACA; }
.btn-danger:hover { background: #FEF2F2; border-color: #F87171; }

/* row actions sit together and shouldn't wrap mid-group */
.row-actions { display: inline-flex; gap: .35rem; white-space: nowrap; }

.btn:disabled, .btn[disabled] { opacity: .55; pointer-events: none; }

/* recurring placements — these were repeated inline on every instance */
.empty .btn { margin-top: 1.25rem; }
.modal-actions .btn-danger { margin-right: auto; }   /* destructive sits apart */
.card-actions { display: grid; gap: .5rem; }         /* stacked CTA in a card */

/* lesson prev/next footer */
.lesson-nav {
  display: flex; gap: .6rem; margin-top: 2rem;
  padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.lesson-nav .btn-next { margin-left: auto; }

/* oversized decorative icons — .ic is 1em, so these need an explicit size */
.player-empty .ic { width: 32px; height: 32px; opacity: .5; }

/* ── app shell ───────────────────────────────────────────────── */

.app-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
  height: 66px; display: flex; align-items: center; gap: 1.5rem;
}
.app-nav .nav-brand { flex: 0 0 auto; }
.app-nav-links { display: flex; gap: .35rem; margin-left: 1rem; list-style: none; }
.app-nav-links a {
  padding: .5rem .85rem; border-radius: var(--pill); font-size: .93rem;
  font-weight: 500; color: var(--ink-2); transition: all .2s var(--ease);
}
.app-nav-links a:hover { background: var(--bg-2); color: var(--ink); }
.app-nav-links a.active { background: var(--blue-soft); color: var(--blue-2); font-weight: 600; }
.app-nav-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }

.avatar {
  width: 36px; height: 36px; border-radius: var(--pill); background: var(--grad);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .85rem;
  flex: 0 0 auto; text-transform: uppercase;
}
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }

.app-main { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem var(--gutter) 5rem; }
.app-head { margin-bottom: 2rem; }
.app-head h1 { font-size: clamp(1.65rem, 3.4vw, 2.35rem); margin-bottom: .35rem; }
.app-head p { color: var(--ink-2); }

/* ── auth ────────────────────────────────────────────────────── */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem var(--gutter);
             background: var(--grad-sky); }
.auth-card {
  width: 100%; max-width: 430px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: clamp(1.75rem, 4vw, 2.5rem); box-shadow: var(--sh-md);
}
.auth-card .nav-brand { justify-content: center; margin-bottom: 1.5rem; }
.auth-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: .4rem; }
.auth-sub { text-align: center; color: var(--ink-2); font-size: .93rem; margin-bottom: 1.75rem; }
.auth-switch { text-align: center; font-size: .9rem; color: var(--ink-2); margin-top: 1.25rem; }
.auth-switch button {
  background: none; border: 0; color: var(--blue-2); font-weight: 600;
  cursor: pointer; font-size: inherit; font-family: inherit;
}

.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; color: var(--ink); }
.field input, .field textarea, .field select {
  width: 100%; padding: .8rem .95rem; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); font: inherit; font-size: .95rem; color: var(--ink);
  background: #fff; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 134, 224, .13);
}
.field textarea { resize: vertical; min-height: 110px; }

.alert { padding: .8rem 1rem; border-radius: var(--r-sm); font-size: .9rem; margin-bottom: 1rem; }
.alert-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-ok    { background: var(--green-soft); color: #2C6E3A; border: 1px solid #BBE9CB; }
.alert-info  { background: var(--blue-soft); color: var(--blue-deep); border: 1px solid #C9E2FB; }

/* ── cards / grids ───────────────────────────────────────────── */

.card-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.course-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .28s var(--ease), border-color .28s var(--ease);
}
.course-card:hover { box-shadow: var(--sh-md); border-color: var(--line-2); }
.course-thumb {
  aspect-ratio: 16 / 9; background: var(--grad); position: relative;
  display: grid; place-items: center; color: #fff; overflow: hidden;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb .ic { width: 42px; height: 42px; opacity: .9; }
.course-body { padding: 1.25rem 1.35rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.course-body h3 { font-size: 1.1rem; line-height: 1.35; margin-bottom: .35rem; }
.course-body p { font-size: .9rem; color: var(--ink-2); line-height: 1.55; margin-bottom: 1rem; }
.course-meta {
  margin-top: auto; display: flex; align-items: center; gap: .75rem;
  font-size: .82rem; color: var(--ink-3); padding-top: .9rem; border-top: 1px solid var(--line);
}
.course-meta .price { margin-left: auto; font-weight: 700; color: var(--ink); font-size: .98rem; }
.course-meta .was { text-decoration: line-through; color: var(--ink-3); font-weight: 500; margin-right: .35rem; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem;
  border-radius: var(--pill); font-size: .72rem; font-weight: 600;
  background: var(--bg-3); color: var(--blue-deep); text-transform: capitalize;
}
.chip-green { background: var(--green-soft); color: #2C6E3A; }
.chip-amber { background: #FEF6E7; color: #9A6700; }
.chip-grey  { background: var(--bg-2); color: var(--ink-2); }

/* ── progress ────────────────────────────────────────────────── */

.bar { height: 6px; background: var(--bg-3); border-radius: var(--pill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: var(--pill);
           transition: width .5s var(--ease); }
.progress-line { display: flex; align-items: center; gap: .75rem; font-size: .82rem; color: var(--ink-2); }
.progress-line .bar { flex: 1; }

/* ── course detail ───────────────────────────────────────────── */

.course-hero { background: var(--grad-ink); color: #fff; padding: 3rem 0 3.5rem; }
.course-hero-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
                     display: grid; grid-template-columns: 1.55fr 1fr; gap: 3rem; align-items: start; }
.course-hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); color: #fff; margin: .6rem 0 .75rem; }
.course-hero p { color: rgba(255, 255, 255, .78); font-size: 1.02rem; line-height: 1.65; }
.course-hero .chip { background: rgba(255, 255, 255, .14); color: #fff; }
.buy-card {
  background: #fff; border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--sh-lg);
  position: sticky; top: 86px;
}
.buy-price { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.buy-card .btn { width: 100%; justify-content: center; margin: 1rem 0 .85rem; }
.buy-list { list-style: none; font-size: .87rem; color: var(--ink-2); display: grid; gap: .55rem; }
.buy-list li { display: flex; gap: .5rem; align-items: flex-start; }
.buy-list .ic { width: 16px; height: 16px; color: var(--green-2); flex: 0 0 auto; margin-top: .12rem; }

.module {
  border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .85rem;
  overflow: hidden; background: #fff;
}
.module-head {
  padding: 1rem 1.25rem; background: var(--bg-2); display: flex;
  align-items: center; gap: .75rem; cursor: pointer; user-select: none;
}
.module-head h4 { font-size: 1rem; flex: 1; }
.module-head .count { font-size: .8rem; color: var(--ink-3); }
.module-head .chev { transition: transform .3s var(--ease); color: var(--ink-3); }
.module.open .module-head .chev { transform: rotate(180deg); }
.module-body { max-height: 0; overflow: hidden; transition: max-height .35s var(--ease); }

.lesson-row {
  display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem;
  border-top: 1px solid var(--line); font-size: .93rem; color: var(--ink-2);
  text-decoration: none; transition: background .2s var(--ease);
}
.lesson-row:hover { background: var(--bg-2); }
.lesson-row .ic { width: 17px; height: 17px; flex: 0 0 auto; color: var(--ink-3); }
.lesson-row .t { flex: 1; color: var(--ink); }
.lesson-row .d { font-size: .8rem; color: var(--ink-3); }
.lesson-row.done .ic { color: var(--green-2); }
.lesson-row.locked { cursor: not-allowed; opacity: .62; }
.lesson-row.current { background: var(--blue-soft); }
.lesson-row.current .t { color: var(--blue-deep); font-weight: 600; }

/* ── player ──────────────────────────────────────────────────── */

.player-layout { display: grid; grid-template-columns: 1fr 340px; gap: 2rem; align-items: start; }
.player-frame {
  aspect-ratio: 16 / 9; background: var(--navy); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--sh-md);
}
.player-frame iframe, .player-frame video { width: 100%; height: 100%; border: 0; display: block; }
.player-empty { width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255,255,255,.5);
                text-align: center; padding: 2rem; font-size: .92rem; }
.player-side {
  border: 1px solid var(--line); border-radius: var(--r); background: #fff;
  max-height: calc(100vh - 120px); overflow-y: auto; position: sticky; top: 86px;
}
.player-side h4 { padding: 1rem 1.15rem .75rem; font-size: .9rem; text-transform: uppercase;
                  letter-spacing: .05em; color: var(--ink-3); }

/* ── Q&A ─────────────────────────────────────────────────────── */

.qna-item {
  border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem 1.4rem;
  margin-bottom: 1rem; background: #fff;
}
.qna-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
.qna-head .who { font-weight: 600; font-size: .88rem; }
.qna-head .at { font-size: .8rem; color: var(--ink-3); }
.qna-item h4 { font-size: 1.02rem; margin-bottom: .4rem; }
.qna-item .body { font-size: .93rem; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; }
.qna-foot { display: flex; align-items: center; gap: 1rem; margin-top: .9rem;
            padding-top: .8rem; border-top: 1px solid var(--line); font-size: .84rem; }
.qna-foot button { background: none; border: 0; color: var(--blue-2); font-weight: 600;
                   cursor: pointer; font-size: inherit; font-family: inherit; padding: 0; }
.answer {
  margin-top: .9rem; padding: .9rem 1rem; background: var(--bg-2);
  border-radius: var(--r-sm); border-left: 3px solid var(--line-2);
}
.answer.accepted { background: var(--green-soft); border-left-color: var(--green-2); }

/* ── admin ───────────────────────────────────────────────────── */

.admin-layout { display: grid; grid-template-columns: 210px 1fr; gap: 2.5rem; align-items: start; }
.admin-side { position: sticky; top: 86px; }
.admin-side a {
  display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border-radius: var(--r-sm);
  font-size: .92rem; color: var(--ink-2); font-weight: 500; margin-bottom: .15rem;
  transition: all .2s var(--ease);
}
.admin-side a:hover { background: var(--bg-2); color: var(--ink); }
.admin-side a.active { background: var(--blue-soft); color: var(--blue-2); font-weight: 600; }
.admin-side .ic { width: 17px; height: 17px; }

.stat-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            margin-bottom: 2rem; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.25rem;
}
.stat .n { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat .l { font-size: .82rem; color: var(--ink-3); margin-top: .2rem; }

.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 620px; }
table.data th {
  text-align: left; padding: .8rem 1rem; background: var(--bg-2); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 700;
  white-space: nowrap;
}
table.data td { padding: .85rem 1rem; border-top: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: var(--bg-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.tabs button {
  padding: .7rem 1.1rem; background: none; border: 0; border-bottom: 2px solid transparent;
  font: inherit; font-size: .93rem; font-weight: 600; color: var(--ink-3); cursor: pointer;
  transition: all .2s var(--ease);
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--blue-2); border-bottom-color: var(--blue); }

/* ── misc ────────────────────────────────────────────────────── */

.empty {
  text-align: center; padding: 3.5rem 1.5rem; color: var(--ink-3);
  border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: var(--bg-2);
}
.empty .ic { width: 34px; height: 34px; margin-bottom: .85rem; opacity: .55; }
.empty h3 { color: var(--ink-2); font-size: 1.05rem; margin-bottom: .35rem; }
.empty p { font-size: .92rem; }

.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
            background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

.modal {
  position: fixed; inset: 0; z-index: 300; display: none; place-items: center;
  background: rgba(6, 11, 34, .55); backdrop-filter: blur(3px); padding: 1.5rem;
}
.modal.open { display: grid; }
.modal-card {
  background: #fff; border-radius: var(--r-lg); padding: 1.75rem; width: 100%;
  max-width: 520px; max-height: 88vh; overflow-y: auto; box-shadow: var(--sh-lg);
}
.modal-card h3 { font-size: 1.2rem; margin-bottom: 1.1rem; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ── lead forms (level survey + enquiry) ─────────────────────── */

.lf-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: clamp(1.5rem, 4vw, 2.25rem); max-width: 620px; margin: 0 auto;
  box-shadow: var(--sh-sm);
}
.lf-head { margin-bottom: 1.25rem; }
.lf-head .chip { margin-bottom: .6rem; }
.lf-head h3 { font-size: 1.3rem; margin-bottom: .3rem; }
.lf-head p { color: var(--ink-2); font-size: .93rem; }

.lf-progress { height: 5px; background: var(--bg-3); border-radius: var(--pill); overflow: hidden; margin-bottom: 1.5rem; }
.lf-progress > i { display: block; height: 100%; background: var(--grad); border-radius: var(--pill); transition: width .4s var(--ease); }

.lf-step { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .5rem; }
.lf-q h4 { font-size: 1.15rem; margin-bottom: 1rem; }
.lf-opts { display: grid; gap: .6rem; }
.lf-opt {
  text-align: left; padding: .9rem 1.1rem; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: #fff; font: inherit; font-size: .95rem; font-weight: 500;
  color: var(--ink); cursor: pointer; transition: all .18s var(--ease);
}
.lf-opt:hover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-deep); transform: translateX(3px); }

.lf-form .lf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.lf-result { text-align: center; padding: .5rem 0; }
.lf-badge {
  width: 56px; height: 56px; border-radius: var(--pill); margin: 0 auto 1rem;
  display: grid; place-items: center; background: var(--green-soft); color: var(--green-2);
}
.lf-badge .ic { width: 30px; height: 30px; }
.lf-result h4 { font-size: 1.2rem; margin-bottom: .6rem; }
.lf-result p { color: var(--ink-2); font-size: .95rem; }
.lf-cta { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }
.lf-enquiry { margin-top: 1.5rem; }

/* ── admin analytics ─────────────────────────────────────────── */
.chart-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 1.5rem; }
.chart-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.25rem 1.25rem; }
.chart-card h3 { font-size: .95rem; margin-bottom: .9rem; color: var(--ink-2); }
.chart-card canvas { height: 240px !important; width: 100% !important; }
.funnel-step { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; font-size: .9rem; }
.funnel-step .bar { flex: 1; }
.funnel-step .n { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 56px; text-align: right; }
.funnel-step .pct { color: var(--ink-3); font-size: .8rem; min-width: 44px; text-align: right; }

/* ── responsive ──────────────────────────────────────────────── */

@media (max-width: 980px) {
  .course-hero-inner { grid-template-columns: 1fr; gap: 2rem; }
  .buy-card { position: static; }
  .player-layout { grid-template-columns: 1fr; }
  .player-side { position: static; max-height: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .5rem; }
  .admin-side a { white-space: nowrap; }
}
@media (max-width: 640px) {
  .app-nav-links { display: none; }
  .app-main { padding-top: 1.75rem; }
  .lf-form .lf-row { grid-template-columns: 1fr; }
}
