/* =====================================================================
   HackingVichar - app layer (loaded after site.css)
   1. design tokens   2. student app shell   3. app components
   4. phone refinements for the whole site   5. print
   ===================================================================== */

:root {
  --app-bg: #f4f6fb;
  --surface: #fff;
  --r-card: 18px;      /* big surfaces */
  --r-ctl: 12px;       /* buttons, inputs, rows */
  --side-w: 256px;
  --tabbar-h: 64px;
  --top-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow-1: 0 1px 2px rgba(27, 23, 64, .05), 0 6px 18px rgba(27, 23, 64, .05);
  --ok: #1e9e5a; --warn: #b7791f; --bad: #d64545;
}

html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(63, 111, 181, .45); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- 2. student app shell ---------- */
.app-body { background: var(--app-bg); }
.app { min-height: 100vh; }

.app-side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  display: none; flex-direction: column; padding: 1.1rem .9rem;
  background: #15113a; color: #c9c6e8;
}
.app-brand { padding: .3rem .5rem 1.2rem; }
.app-brand .brand-name { color: #fff; } .app-brand .brand-name span { color: #8fb3e8; }
.side-nav { display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: .75rem; padding: .68rem .85rem; border-radius: var(--r-ctl);
  color: #b9b5df; text-decoration: none; font-weight: 600; font-size: .92rem; transition: background .15s, color .15s;
}
.side-nav a i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.on { background: #fff; color: var(--navy); }
.side-nav a.on i { color: var(--indigo); }
.side-label { margin: 1.3rem .85rem .4rem; font-size: .7rem; font-weight: 700; color: #7d79ad; letter-spacing: .02em; }
.side-user { display: flex; align-items: center; gap: .65rem; padding: .8rem .6rem 0; margin-top: .6rem; border-top: 1px solid rgba(255, 255, 255, .09); }
.side-user .who { min-width: 0; flex: 1; }
.side-user .nm { color: #fff; font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .em { font-size: .72rem; color: #8f8bbd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .out { color: #b9b5df; font-size: 1.15rem; padding: .35rem; border-radius: 8px; } .side-user .out:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4a3f9f, #3f6fb5); color: #fff; font-weight: 700; font-size: .9rem;
}

.app-col { min-width: 0; }
.app-top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; gap: .7rem; padding: 0 1rem;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.brand-badge.sm { width: 34px; height: 34px; border-radius: 10px; font-size: .78rem; }
.app-title { margin: 0; font: 700 1.05rem 'Inter', system-ui, sans-serif; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.app-main { padding: 1.1rem 1rem calc(var(--tabbar-h) + var(--safe-b) + 1.4rem); max-width: 1180px; margin: 0 auto; }

/* bottom tab bar (phones / tablets) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar .tab {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #8a8da6; text-decoration: none; font-size: .68rem; font-weight: 600; min-width: 0;
}
.tabbar .tab i { font-size: 1.35rem; line-height: 1; }
.tabbar .tab.on { color: var(--indigo); }
.tabbar .tab.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--indigo); }
.tabbar .tab:active { background: var(--soft); }

@media (min-width: 992px) {
  .app-side { display: flex; }
  .app-col { margin-left: var(--side-w); }
  .tabbar { display: none; }
  .app-top { padding: 0 1.6rem; }
  .app-main { padding: 1.6rem 1.6rem 2.5rem; }
}

/* the shell already shows the page title in the top bar on phones */
@media (max-width: 991.98px) { .app-main .page-head h2 { display: none; } .app-main .page-head p { margin-top: 0; } }
.app-main .section.pt-4, .app-main .section.pt-5 { padding-top: 0 !important; }

/* the old in-page tab strip is replaced by the shell */
.app-main .portal-nav { display: none; }
/* views were written for the public layout: flatten their wrappers inside the shell */
.app-main .section { padding-top: 0; padding-bottom: 0; }
.app-main .container, .app-main .container-xl { max-width: none; padding-left: 0; padding-right: 0; }
.app-main .learn-wrap { background: none; padding: 0; min-height: 0; }
.app-main .alert { border-radius: var(--r-ctl); }

/* ---------- 3. app components ---------- */
.app-main h2.serif, .app-main h4.serif, .app-main h5.serif { font-family: 'Inter', system-ui, sans-serif; letter-spacing: -.01em; }
.app-main h2.serif { font-size: 1.35rem; margin-bottom: .2rem; }
.app-main h4.serif { font-size: 1.1rem; }
.app-main h5.serif { font-size: 1rem; }
.app-main .form-card, .app-main .buy-card, .panel-app {
  background: var(--surface); border: 0; border-radius: var(--r-card); box-shadow: var(--shadow-1); padding: 1.25rem;
}
.app-main .form-card { margin-bottom: 1rem; }
.app-main .stat-box { border: 0; box-shadow: var(--shadow-1); border-radius: var(--r-card); }
.app-main .empty-box { background: var(--surface); box-shadow: var(--shadow-1); border-radius: var(--r-card); }
.app-main .btn-site, .app-main .btn-outline-site { border-radius: var(--r-ctl); }
.app-main .progress { background: #e9ecf6; border-radius: 99px; height: 8px; }
.app-main .progress-bar { background: linear-gradient(90deg, #4a3f9f, #3f6fb5); border-radius: 99px; }

.page-head { margin-bottom: 1.1rem; }
.page-head h2 { margin: 0; }
.page-head p { margin: .15rem 0 0; color: var(--muted); font-size: .92rem; }

/* greeting + continue card */
.hello { margin-bottom: 1.1rem; }
.hello h2 { font: 700 1.45rem/1.2 'Inter', system-ui, sans-serif; letter-spacing: -.02em; margin: 0; }
.hello p { color: var(--muted); margin: .15rem 0 0; font-size: .92rem; }

.resume {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1rem;
  padding: 1.25rem; border-radius: var(--r-card); color: #fff; text-decoration: none;
  background: linear-gradient(135deg, #1b1740 0%, #3a2f87 100%); box-shadow: 0 14px 30px rgba(27, 23, 64, .22);
}
.resume:hover { color: #fff; filter: brightness(1.06); }
.resume::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); }
.resume .body { position: relative; z-index: 1; min-width: 0; flex: 1; }
.resume .kicker { font-size: .76rem; color: #aaa6dd; font-weight: 600; }
.resume h3 { color: #fff; font: 700 1.15rem/1.3 'Inter', system-ui, sans-serif; margin: .2rem 0 .75rem; }
.resume .go { display: inline-flex; align-items: center; gap: .4rem; background: #fff; color: var(--navy); font-weight: 700; font-size: .85rem; padding: .5rem 1rem; border-radius: 99px; }
.ring { --p: 0; position: relative; z-index: 1; flex-shrink: 0; width: 76px; height: 76px; border-radius: 50%;
  background: conic-gradient(#8fb3e8 calc(var(--p) * 1%), rgba(255, 255, 255, .14) 0);
  display: grid; place-items: center; }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #2a2262; }
.ring b { position: relative; font-size: .95rem; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-1); padding: .9rem; color: inherit; text-decoration: none; display: block; }
.tile i { font-size: 1.15rem; color: var(--indigo); background: #ece9fb; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: .55rem; }
.tile .n { font: 700 1.35rem/1.1 'Inter', sans-serif; color: var(--navy); display: block; }
.tile .l { font-size: .75rem; color: var(--muted); }
a.tile:hover { color: inherit; transform: translateY(-2px); transition: .15s; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 1.3rem 0 .6rem; }
.sec-head h4 { margin: 0; }
.sec-head a { font-size: .85rem; font-weight: 600; text-decoration: none; }

/* live class card */
.live-next { display: flex; align-items: center; gap: .9rem; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-1); padding: 1rem 1.1rem; margin-bottom: .7rem; }
.live-next .dot { width: 46px; height: 46px; border-radius: 13px; background: #fde4e3; color: var(--coral); display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.live-next .t { font-weight: 700; color: var(--navy); font-size: .95rem; }
.live-next .w { font-size: .8rem; color: var(--muted); }
.live-next .grow { min-width: 0; flex: 1; }

/* course rows (horizontal, compact; cards on wide screens) */
.course-grid { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.crs { display: flex; gap: .9rem; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-1); padding: .8rem; text-decoration: none; color: inherit; }
.crs:hover { color: inherit; box-shadow: 0 10px 26px rgba(27, 23, 64, .1); }
.crs .thumb { width: 92px; height: 92px; flex-shrink: 0; border-radius: 14px; background: linear-gradient(135deg, #17174a, #3a3aa0) center/cover; display: grid; place-items: center; color: rgba(255, 255, 255, .85); font-size: 1.9rem; }
.crs .info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.crs h5 { font: 700 .98rem/1.3 'Inter', sans-serif; margin: 0 0 .25rem; color: var(--navy);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crs .meta { font-size: .76rem; color: var(--muted); margin-bottom: .5rem; }
.crs .bar { margin-top: auto; }
.crs .pct { font-size: .74rem; color: var(--muted); display: flex; justify-content: space-between; margin-top: .3rem; }
@media (min-width: 768px) { .course-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .course-grid { grid-template-columns: repeat(3, 1fr); } }

/* announcements */
.news-item { padding: .75rem 0; border-top: 1px solid var(--line); } .news-item:first-child { border-top: 0; padding-top: 0; } .news-item:last-child { padding-bottom: 0; }
.news-item .d { font-size: .74rem; color: var(--muted); }

/* payments as stacked cards on phones, table on desktop */
.pay-list { display: grid; gap: .7rem; }
.pay { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-1); padding: .95rem 1rem; }
.pay .row1 { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; }
.pay .what { font-weight: 700; color: var(--navy); font-size: .95rem; min-width: 0; }
.pay .amt { font-weight: 700; color: var(--navy); white-space: nowrap; }
.pay .sub { font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.pay .row2 { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--line); }

/* lesson list / player on phones */
.player-box { border-radius: 14px; }
.lesson-side { border: 0; box-shadow: var(--shadow-1); border-radius: var(--r-card); }

/* ---------- 4. phone refinements (whole site) ---------- */
@media (max-width: 991.98px) {
  .site-nav .navbar-collapse { padding: .6rem 0 .4rem; }
  .site-nav .nav-link { padding: .7rem .8rem; }
  .buy-card { position: static; }
  .learn-wrap { padding-top: 1rem; }
}
@media (max-width: 767.98px) {
  body { font-size: 15px; }
  .hero { padding: 2.2rem 0 2.6rem; } .page-hero { padding: 2rem 0; }
  .section { padding-top: 2.2rem; padding-bottom: 2.2rem; }
  .section-head { margin-bottom: 1.4rem; } .section-head h2 { font-size: 1.5rem; }
  .display-title { font-size: 2rem; }
  .cta-band { padding: 1.7rem 1.3rem; border-radius: 18px; }
  .story-box { padding: 1.4rem; }
  .hero-card { padding: 1.3rem; }
  .stat-box .num { font-size: 1.3rem; }
  .form-card, .buy-card { padding: 1.3rem; }
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .form-control, .form-select { min-height: 44px; }
  .form-control, .form-select, .field input, .field textarea { font-size: 16px; }   /* stops iOS zooming into inputs */
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -.75rem; padding: 0 .75rem .3rem; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; } .chip { white-space: nowrap; }
  .course-media { height: 130px; }
  .ft-cta { text-align: left; } .ft-cta .btn { width: 100%; }
  .receipt { padding: 1.3rem; }
  .app-main .form-card, .app-main .buy-card { padding: 1.05rem; }
  .tiles { gap: .5rem; } .tile { padding: .75rem .7rem; } .tile .n { font-size: 1.15rem; } .tile .l { font-size: .7rem; }
  .resume { padding: 1.05rem; gap: .8rem; } .ring { width: 64px; height: 64px; } .ring::before { inset: 6px; }
  .app-main h2.serif { font-size: 1.25rem; }
  .table-responsive-sm { overflow-x: auto; }
}
/* logged-in visitors on the public pages also get the bottom tab bar */
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
@media (min-width: 992px) { body.has-tabbar { padding-bottom: 0; } }

/* ---------- 5. print ---------- */
@media print {
  .app-side, .app-top, .tabbar { display: none !important; }
  .app-col { margin-left: 0 !important; }
  .app-main { padding: 0 !important; max-width: none; }
  body.has-tabbar { padding-bottom: 0; }
}

/* course player */
.app-main .learn-wrap h3.serif { font: 700 1.15rem/1.3 'Inter', system-ui, sans-serif; }
@media (max-width: 767.98px) {
  .learn-wrap .player-box { margin-inline: -1rem; border-radius: 0; }   /* full-bleed video on phones */
  #btnDone { width: 100%; }
  .learn-wrap .border-top .btn { flex: 1; } .learn-wrap .border-top { gap: .6rem; }
  .learn-wrap .border-top > span { display: none; }
  .pdf-box iframe { height: 60vh; }
}

/* logo */
.brand-logo { height: 36px; width: auto; display: block; }
.site-nav .brand-logo { height: 55px; }
.app-brand .brand-logo { height: 55px; }
.brand-mark { height: 32px; width: auto; display: block; }
.site-footer .brand-logo { height: 55px; }
.split-left .brand-logo { height: 40px; }
@media (max-width: 575.98px) { .site-nav .brand-logo { height: 32px; } }
.app-main h3.serif { font: 700 1.15rem/1.3 'Inter', system-ui, sans-serif; }
