/* Learning Portal | Shikshanganga Foundation
   Colours and fonts from the official letterhead. */
:root {
  --navy: #0B2A49;
  --navy-2: #133A61;
  --teal: #1F7A73;
  --teal-soft: #DCEAE9;
  --gold: #F0B429;
  --gold-soft: #FDF3DA;
  --bg: #F3F7F7;
  --card: #FFFFFF;
  --ink: #1E2B3A;
  --muted: #5E6B7A;
  --line: #DCE5E4;
  --red: #B3402A;
  --red-soft: #FBE9E5;
  --green: #217A4B;
  --green-soft: #E3F3EA;
  --radius: 12px;
  --head: 'Eczar', Georgia, 'Times New Roman', serif;
  --body: 'Nunito', 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--head); color: var(--navy); line-height: 1.2; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
a { color: var(--teal); }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Boot + sign in */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: linear-gradient(90deg, var(--teal) 70%, var(--gold) 70%); }
.auth-side h1 { color: #fff; font-size: 2.3rem; margin-top: 28px; }
.auth-side .tag { color: var(--gold); font-weight: 700; }
.auth-side p { color: #d4e0ea; max-width: 34em; }
.auth-logo { display: flex; align-items: center; gap: 14px; }
.auth-logo img { width: 74px; height: 74px; background: #fff; border-radius: 16px; padding: 4px; border: 3px solid var(--gold); }
.auth-logo b { font-family: var(--head); font-size: 1.25rem; letter-spacing: .3px; display: block; }
.open-list { margin-top: 26px; display: grid; gap: 8px; max-width: 34em; }
.open-list div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; padding: 9px 12px; font-size: .92rem; }
.open-list b { color: #fff; }
.open-list span { color: #b9c9d8; display: block; font-size: .84rem; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h2 { font-size: 1.6rem; }
.tabs { display: flex; gap: 4px; background: #e6eeee; padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(11,42,73,.12); }
.code-input { font: 700 1.8rem/1 Consolas, Menlo, monospace !important; letter-spacing: .5em; text-align: center; }

/* Layout */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #cfdbe6; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.08); text-decoration: none; }
.brand img { width: 46px; height: 46px; background: #fff; border-radius: 11px; padding: 2px; border: 2px solid var(--gold); }
.brand b { font-family: var(--head); color: #fff; font-size: 1rem; display: block; line-height: 1.15; }
.brand span { color: var(--gold); font-size: .8rem; font-weight: 700; }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav h4 { margin: 16px 10px 6px; font-size: .78rem; color: #8fa6bb; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #dbe5ee; text-decoration: none; font-weight: 600; font-size: .94rem; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.on { background: rgba(240,180,41,.14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav .ic { width: 18px; text-align: center; opacity: .9; }
.nav .count { margin-left: auto; background: var(--gold); color: var(--navy); font-size: .75rem; font-weight: 800; border-radius: 20px; padding: 0 7px; }
.side-foot { padding: 12px 16px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .86rem; }
.side-foot b { color: #fff; display: block; }
.side-foot button { margin-top: 8px; }
.main { min-width: 0; }
.top { display: none; }
.page { padding: 26px 30px 60px; max-width: 1180px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--muted); }

/* Cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { font-family: var(--head); font-size: 1.9rem; color: var(--navy); display: block; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .88rem; }
.stat.hl { border-top: 4px solid var(--gold); }
.stat.tl { border-top: 4px solid var(--teal); }
.course-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.course-card h3 { margin: 0; }
.course-card .meta { color: var(--muted); font-size: .86rem; }
.course-card .actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar { height: 8px; background: #e5eded; border-radius: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--teal); border-radius: 10px; }
.bar.big { height: 12px; }

/* Badges */
.badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: #edf1f4; color: var(--navy); white-space: nowrap; }
.b-teal { background: var(--teal-soft); color: #145650; }
.b-gold { background: var(--gold-soft); color: #7a5607; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-navy { background: var(--navy); color: #fff; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; background: var(--navy); color: #fff; padding: 9px 16px; border-radius: 9px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: .93rem; line-height: 1.2; }
.btn:hover { background: var(--navy-2); }
.btn.teal { background: var(--teal); } .btn.teal:hover { background: #18655f; }
.btn.gold { background: var(--gold); color: var(--navy); } .btn.gold:hover { background: #e3a619; }
.btn.light { background: #fff; color: var(--navy); border-color: var(--line); } .btn.light:hover { background: #f2f6f6; }
.btn.red { background: #fff; color: var(--red); border-color: #efc8bf; } .btn.red:hover { background: var(--red-soft); }
.btn.sm { padding: 5px 11px; font-size: .84rem; border-radius: 7px; }
.btn.block { width: 100%; padding: 12px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.linkbtn { background: none; border: 0; color: var(--teal); font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.side .btn.light { background: transparent; color: #dbe5ee; border-color: rgba(255,255,255,.25); }
label { display: block; font-weight: 700; font-size: .9rem; margin: 0 0 4px; color: var(--navy); }
.field { margin-bottom: 14px; }
.field small { display: block; font-weight: 400; margin-top: 3px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #c9d6d5; border-radius: 9px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 2px solid var(--teal-soft); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: .92rem; margin: 6px 0; color: var(--ink); cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--teal); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 180px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.f3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; background: #f3f7f7; color: var(--navy); font-weight: 800; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid #edf2f2; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: .83rem; display: block; }
td.num, th.num { text-align: right; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* Course player */
.course-head { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; border-bottom: 5px solid var(--gold); }
.course-head h1 { color: #fff; margin: 4px 0 6px; }
.course-head p { color: #d4e0ea; margin: 0 0 6px; }
.course-head .badge { background: rgba(255,255,255,.14); color: #fff; }
.course-head .bar { background: rgba(255,255,255,.2); margin-top: 10px; }
.course-head .bar i { background: var(--gold); }
.module { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.module > h3 { margin: 0; padding: 13px 18px; background: #f3f7f7; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.item { border-bottom: 1px solid #edf2f2; }
.item:last-child { border-bottom: 0; }
.item-head { display: flex; gap: 12px; align-items: center; padding: 12px 18px; cursor: pointer; background: none; border: 0; width: 100%; text-align: left; }
.item-head:hover { background: #f8fbfb; }
.tick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c3d1d0; display: grid; place-items: center; flex: none; font-size: .8rem; color: #fff; }
.tick.done { background: var(--teal); border-color: var(--teal); }
.tick.retry { border-color: var(--gold); color: var(--gold); }
.item-head .t { flex: 1; min-width: 0; font-weight: 700; color: var(--ink); }
.item-head .t small { display: block; font-weight: 600; }
.item-body { padding: 4px 18px 18px 56px; }
.prose { max-width: 70ch; }
.prose ul { padding-left: 1.2em; margin: 0 0 .8em; }
.embed { position: relative; padding-top: 56.25%; border-radius: 10px; overflow: hidden; background: #000; max-width: 760px; margin-bottom: 12px; }
.embed iframe, .embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.quiz-q { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.quiz-q p { font-weight: 700; margin-bottom: 6px; }
.note { background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: .93rem; }
.note.teal { background: var(--teal-soft); border-color: var(--teal); }
.note.red { background: var(--red-soft); border-color: var(--red); }
.feed { display: grid; gap: 10px; }
.feed .ann { border-left: 4px solid var(--teal); background: #fff; border-radius: 0 10px 10px 0; padding: 10px 14px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feed .ann b { color: var(--navy); }

/* Builder */
.b-item { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid #edf2f2; }
.b-item:last-child { border-bottom: 0; }
.b-item .t { flex: 1; min-width: 0; }
.b-item .t b { display: block; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 7px; width: 30px; height: 30px; cursor: pointer; color: var(--navy); }
.icon-btn:hover { background: #f2f6f6; }
.qrow { border: 1px dashed #c3d1d0; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fafcfc; }

/* Charts (simple bars) */
.hbars { display: grid; gap: 7px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 8px; align-items: center; font-size: .87rem; }
.hbar .tr { background: #e8efef; border-radius: 6px; height: 14px; overflow: hidden; }
.hbar .tr i { display: block; height: 100%; background: var(--teal); }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: .72rem; color: var(--muted); }
.cols .pair { display: flex; gap: 2px; align-items: flex-end; width: 100%; justify-content: center; flex: 1; }
.cols .pair i { width: 40%; max-width: 16px; background: var(--navy); border-radius: 3px 3px 0 0; min-height: 2px; }
.cols .pair i + i { background: var(--gold); }
.legend { display: flex; gap: 14px; font-size: .83rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* Modal + toast */
.modal { position: fixed; inset: 0; background: rgba(11,42,73,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: 0 20px 50px rgba(11,42,73,.3); }
.modal-box.wide { max-width: 900px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 92vw; border-bottom: 3px solid var(--gold); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); border-color: #fff; }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 14px; font-weight: 700; color: var(--muted); cursor: pointer; }
.pill-tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }

/* Live class room + chat */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "top side" "rest side"; grid-template-rows: auto 1fr; gap: 0 16px; align-items: start; }
.live-top { grid-area: top; } .live-rest { grid-area: rest; }
.live-side { grid-area: side; position: sticky; top: 16px; }
.b-item .t small { display: block; }
.join-card { border-top: 4px solid var(--gold); }
.countdown { font-family: var(--head); font-size: 1.35rem; color: var(--navy); margin-bottom: 6px; }
.join-big { font-size: 1.05rem; padding: 13px 22px; }
.code-big { font: 700 2.4rem/1.2 Consolas, Menlo, monospace; letter-spacing: .35em; color: var(--navy); margin: 6px 0; }
.chat-card { padding: 0; overflow: hidden; }
.chat { display: flex; flex-direction: column; height: min(72vh, 640px); }
.chat-card .chat { height: min(72vh, 640px); }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: center; background: #f3f7f7; }
.chat-list { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { background: #f3f7f7; border-radius: 10px; padding: 7px 11px; max-width: 92%; align-self: flex-start; font-size: .92rem; }
.msg.me { background: var(--teal-soft); align-self: flex-end; }
.msg.q { border-left: 4px solid var(--gold); }
.msg.q.ans { border-left-color: var(--green); }
.msg .mh { font-size: .8rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg .mh b { color: var(--navy); }
.msg .mh small { color: var(--muted); margin-left: auto; }
.msg .mb { word-break: break-word; }
.msg .ma { display: flex; gap: 10px; font-size: .78rem; }
.msg .ma:empty { display: none; }
.chat-form { border-top: 1px solid var(--line); padding: 10px 12px; }
.chat-form textarea { min-height: 52px; margin-bottom: 6px; }
@media (max-width: 1000px) { .live-grid { grid-template-columns: 1fr; grid-template-areas: "top" "side" "rest"; } .live-side { position: static; } .chat, .chat-card .chat { height: 460px; } }

/* Mobile */
@media (max-width: 960px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 26px 22px 30px; }
  .auth-side h1 { font-size: 1.7rem; margin-top: 16px; }
  .open-list { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(11,42,73,.45); }
  .top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; border-bottom: 3px solid var(--gold); }
  .top img { width: 34px; height: 34px; background: #fff; border-radius: 8px; padding: 1px; }
  .top b { font-family: var(--head); font-size: 1rem; }
  .top button { background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 0 6px; }
  .page { padding: 18px 14px 50px; }
  .g2, .f2, .f3, .perm-grid { grid-template-columns: 1fr; }
  .item-body { padding-left: 18px; }
  .hbar { grid-template-columns: 100px 1fr 34px; }
}
@media (max-width: 480px) { .g4, .g3 { grid-template-columns: 1fr 1fr; } h1 { font-size: 1.45rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .top, .btn, .toolbar { display: none !important; } .shell { display: block; } }
