/* ==========================================================================
   VidyaTube — Premium mobile-first stylesheet
   BUILD: v3-2026-09-09 (full redesign: topbar/drawer, note-card v2, chapters,
   admin v2, cart removed)
   ========================================================================== */

:root {
  --navy: #0b1f3a;
  --navy-dark: #071429;
  --navy-2: #102a4c;
  --blue: #1e5eff;
  --blue-2: #0f4fe0;
  --blue-light: #eaf1ff;
  --gold: #f2a204;
  --gold-2: #ffca4d;
  --white: #ffffff;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #101828;
  --text-muted: #667085;
  --text-faint: #98a2b3;
  --border: #e7eaf3;
  --success: #16a34a;
  --success-bg: #e6f8ec;
  --danger: #dc2626;
  --danger-bg: #fdeaea;
  --warning: #b45309;
  --warning-bg: #fff3dc;
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 3px rgba(16,24,40,.07);
  --shadow: 0 4px 16px rgba(16,24,40,.08);
  --shadow-lg: 0 16px 36px rgba(16,24,40,.16);
  --header-h: 58px;
  --bottom-nav-h: 62px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Poppins', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--bottom-nav-h) + 6px);
  min-width: 0;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Long-press / right-click download deterrent ----------
   Casual "long-press -> Download image / Download link" from the
   browser's own context menu is blocked on every image and link.
   (This is a UI-level deterrent for ordinary visitors, not a way to
   stop a determined developer with dev-tools — the real protection
   for paid PDFs is the payment + token check in download.php, which
   this does not touch or weaken.) */
img, a {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: auto;
}
/* Regular body text stays selectable/copyable (order numbers, emails, etc.) */
p, h1, h2, h3, h4, span, li, td, th, label, input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4,p { margin: 0; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; min-width: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px 22px; border-radius: 999px; border: none;
  font-weight: 600; font-size: 15px; transition: transform .15s, opacity .15s, box-shadow .15s;
  min-height: 46px; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%); color: var(--white); box-shadow: 0 6px 16px rgba(30,94,255,.32); }
.btn-primary:hover { opacity: .95; }
.btn-primary:disabled { opacity: .55; box-shadow: none; transform: none; }
.btn-outline { background: var(--white); color: var(--blue); border: 1.5px solid #cfdcff; }
.btn-outline:hover { background: var(--blue-light); }
.btn-block { width: 100%; }
.btn-success { background: linear-gradient(135deg, #17b358 0%, #0f9a49 100%); color: var(--white); box-shadow: 0 6px 16px rgba(22,163,74,.28); }
.btn-sm { padding: 9px 16px; font-size: 13px; min-height: 36px; }
.btn-xs { padding: 6px 12px; font-size: 12px; min-height: 30px; border-radius: 999px; }
.btn-danger { background: linear-gradient(135deg,#ef4444,#dc2626); color: #fff; box-shadow: 0 6px 16px rgba(220,38,38,.24); }
.btn-ghost { background: #f1f4fa; color: var(--text); }
.btn-icon { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; background: #f1f4fa; color: var(--text); }

/* ---------- Top App Bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: var(--white);
  box-shadow: 0 2px 12px rgba(7,20,41,.25);
}
.topbar-inner {
  height: var(--header-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; gap: 10px; max-width: 1180px; margin: 0 auto;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--white); min-width: 0; }
.topbar-logo { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px rgba(255,255,255,.15); }
.topbar-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-back { font-size: 24px; color: var(--white); background: rgba(255,255,255,.08); width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.topbar-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hamburger { background: rgba(255,255,255,.08); border: none; color: var(--white); font-size: 19px; width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.nav-desktop { display: none; gap: 22px; }
.nav-desktop a { color: #cfe0ff; font-weight: 500; font-size: 14px; }
.nav-desktop a:hover { color: var(--white); }

/* ---------- Drawer menu ---------- */
.drawer { position: fixed; inset: 0; z-index: 300; display: none; }
.drawer.open { display: block; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(4,10,22,.55); backdrop-filter: blur(1px); }
.drawer-panel {
  position: absolute; top: 0; right: 0; width: 82%; max-width: 310px; height: 100%;
  background: var(--white); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(0); animation: drawerIn .22s ease;
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-close { align-self: flex-end; font-size: 18px; background: #f1f4fa; border: none; width: 32px; height: 32px; border-radius: 50%; margin: 14px 14px 0 0; }
.drawer-brand { display: flex; flex-direction: column; align-items: center; padding: 4px 20px 18px; border-bottom: 1px solid #eef1f6; margin-bottom: 6px; }
.drawer-logo { width: 62px; height: 62px; border-radius: 50%; box-shadow: 0 4px 14px rgba(11,31,58,.22); margin-bottom: 10px; }
.drawer-brand-name { font-weight: 700; font-size: 17px; color: var(--navy); }
.drawer-brand-tag { font-size: 10.5px; letter-spacing: 1.5px; color: var(--text-muted); margin-top: 2px; }
.drawer-menu { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; overflow-y: auto; }
.drawer-menu a { padding: 13px 12px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14.5px; color: var(--text); display: flex; align-items: center; gap: 12px; }
.drawer-menu a:active, .drawer-menu a:hover { background: #f4f7ff; }
.drawer-menu .drawer-logout { color: var(--danger); margin-top: 8px; border-top: 1px solid #eef1f6; padding-top: 14px; }

/* ---------- Bottom mobile nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  background: var(--white); border-top: 1px solid #eef1f6;
  display: flex; justify-content: space-around; padding: 7px 0 calc(env(safe-area-inset-bottom, 0px) + 6px);
  box-shadow: 0 -4px 18px rgba(16,24,40,.06);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; font-size: 10.5px; font-weight: 500; color: var(--text-faint); gap: 3px; padding: 2px 10px; }
.bottom-nav a.active { color: var(--blue); }
.bottom-nav .bn-icon { font-size: 20px; line-height: 1; }
@media (min-width: 900px) { .bottom-nav { display: none; } body { padding-bottom: 0; } }

/* ---------- Splash screen ---------- */
.vt-splash {
  position: fixed; inset: 0; z-index: 999;
  background: radial-gradient(circle at 30% 20%, #123a73 0%, var(--navy) 45%, var(--navy-dark) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center;
}
.vt-splash img { width: 108px; height: 108px; border-radius: 50%; box-shadow: 0 0 0 6px rgba(255,255,255,.08), 0 18px 40px rgba(0,0,0,.4); margin-bottom: 18px; animation: vtPop .5s cubic-bezier(.34,1.56,.64,1); }
.vt-splash .brand { font-size: 26px; font-weight: 700; letter-spacing: .3px; }
.vt-splash .tag { font-size: 12px; color: #9db3dd; letter-spacing: 2.5px; margin-top: 6px; }
.vt-splash .spin { margin-top: 32px; width: 30px; height: 30px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--gold); border-radius: 50%; animation: vtspin .8s linear infinite; }
.vt-splash .foot { position: absolute; bottom: 34px; font-size: 11.5px; color: #7d8fb3; }
@keyframes vtspin { to { transform: rotate(360deg); } }
@keyframes vtPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Hero / promo ---------- */
.hero { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%); color: var(--white); padding: 40px 0 48px; text-align: center; }
.hero h1 { font-size: 26px; line-height: 1.3; margin: 0 0 10px; }
.hero p { color: #b9c8e6; font-size: 14px; margin: 0 0 22px; }

.top-search { padding-top: 14px; padding-bottom: 4px; }

.promo-card {
  background: linear-gradient(135deg, var(--navy) 0%, #123a73 60%, #1a4a8f 100%);
  border-radius: var(--radius-xl); color: var(--white); padding: 24px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  overflow: hidden; position: relative; margin: 16px 0; box-shadow: var(--shadow-lg);
  min-width: 0;
}
.promo-card::after { content: ''; position: absolute; width: 160px; height: 160px; background: radial-gradient(circle, rgba(255,255,255,.10), transparent 70%); top: -60px; right: -40px; border-radius: 50%; }
.promo-card .content { flex: 1.3; min-width: 0; position: relative; z-index: 1; }
.promo-card h2 { font-size: 19px; line-height: 1.32; margin: 0 0 14px; font-weight: 700; }
.promo-card .btn { background: var(--white); color: var(--navy); padding: 10px 20px; font-size: 13px; box-shadow: none; }
.promo-card .art { font-size: 44px; flex-shrink: 0; text-align: right; opacity: .95; position: relative; z-index: 1; }

/* ---------- Section headings ---------- */
.section { padding-top: 26px; padding-bottom: 26px; min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.section-title { font-size: 19px; font-weight: 700; margin: 0; }
.section-link { font-size: 12.5px; font-weight: 600; color: var(--blue); white-space: nowrap; }
.section-sub { color: var(--text-muted); font-size: 12.5px; margin: 2px 0 16px; }

/* ---------- Category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(5, minmax(0,1fr)); } }
.cat-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 15px 6px;
  text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  min-width: 0; transition: box-shadow .15s, transform .15s;
}
.cat-card:active { transform: scale(.96); }
.cat-card .icon-sq {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 19px; margin: 0 auto 8px;
}
.cat-card .name { font-size: 12px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card .meta { font-size: 9.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-sq.c1 { background: #e3f7ea; color: #16a34a; }
.icon-sq.c2 { background: #fef1e0; color: #e8912d; }
.icon-sq.c3 { background: #f2e9fb; color: #8b5cf6; }
.icon-sq.c4 { background: #fde8ef; color: #ec4899; }
.icon-sq.c5 { background: #e0f4f4; color: #0d9488; }

/* ---------- Select-your-class list rows ---------- */
.class-list { display: flex; flex-direction: column; gap: 10px; }
.class-row {
  display: flex; align-items: center; gap: 12px; background: var(--white);
  border-radius: var(--radius-lg); padding: 13px 14px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border); min-width: 0;
}
.class-row .icon-sq { margin: 0; flex-shrink: 0; }
.class-row .info { flex: 1; min-width: 0; }
.class-row .info .name { display: block; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-row .info .meta { font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class-row .arrow { color: var(--text-faint); font-size: 20px; flex-shrink: 0; }

/* ---------- Note cards (v2 — fixes text overflow, adds discount badge) ---------- */
.note-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
@media (min-width: 640px) { .note-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 980px) { .note-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.note-card {
  background: var(--white); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; flex-direction: column;
  min-width: 0; max-width: 100%;
}
.note-card .thumb { position: relative; aspect-ratio: 3/3.4; background: linear-gradient(135deg,var(--blue-light),#dbe8ff); display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--blue); overflow: hidden; }
.note-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.note-card .off-badge { position: absolute; top: 8px; right: 8px; background: var(--success); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.note-card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.note-card .tag { font-size: 10.5px; color: var(--blue); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card .title {
  font-size: 13px; font-weight: 600; line-height: 1.35; min-height: 2.7em; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word; overflow-wrap: anywhere;
}
.note-card .rating { font-size: 11px; color: var(--warning); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-card .price-row { display: flex; align-items: baseline; gap: 6px; margin-top: 1px; flex-wrap: wrap; min-width: 0; }
.note-card .price { font-weight: 700; color: var(--navy); font-size: 15px; white-space: nowrap; }
.note-card .old-price { text-decoration: line-through; color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
.note-card .btn { margin-top: 4px; }
.note-card .chapters-count { font-size: 10.5px; color: var(--text-muted); }

/* ---------- Why VidyaTube ---------- */
.why-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (min-width: 640px) { .why-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.why-card { background: var(--white); border-radius: var(--radius-lg); padding: 18px 10px; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border); min-width: 0; }
.why-card .emoji { font-size: 24px; margin-bottom: 8px; }
.why-card .label { font-size: 12px; font-weight: 600; overflow-wrap: break-word; }

/* ---------- Forms ---------- */
.auth-wrap { max-width: 420px; margin: 24px auto; padding: 0 16px; }
.auth-card { background: var(--white); border-radius: var(--radius-xl); padding: 28px 22px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-card h1 { font-size: 21px; margin: 0 0 4px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.form-group { margin-bottom: 14px; min-width: 0; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 13px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  font-size: 15px; background: #fbfcfe; min-width: 0;
}
.form-control:focus { outline: none; border-color: var(--blue); background: #fff; }
textarea.form-control { resize: vertical; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.auth-links { text-align: center; font-size: 13px; margin-top: 16px; color: var(--text-muted); }
.auth-links a { color: var(--blue); font-weight: 600; }

.alert { padding: 13px 15px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; line-height: 1.5; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #b7ecc7; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: #f5bcbc; }
.alert-info { background: var(--blue-light); color: var(--blue); border-color: #c6d8ff; }

/* ---------- Filters / search bar ---------- */
.search-bar { display: flex; gap: 6px; background: var(--white); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); min-width: 0; }
.search-bar input { flex: 1; border: none; background: none; padding: 10px 14px; font-size: 14px; min-width: 0; }
.search-bar input:focus { outline: none; }
.search-bar button { background: linear-gradient(135deg,var(--blue),var(--blue-2)); color: #fff; border: none; border-radius: 999px; padding: 0 18px; flex-shrink: 0; }
.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip { flex-shrink: 0; white-space: nowrap; padding: 8px 16px; border-radius: 999px; background: var(--white); border: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.filter-chip.active { background: linear-gradient(135deg,var(--blue),var(--blue-2)); color: #fff; border-color: transparent; }

/* ---------- Note details ---------- */
.note-detail-hero { background: var(--white); padding-top: 20px; padding-bottom: 26px; border-radius: 0 0 26px 26px; box-shadow: var(--shadow-sm); }
.note-detail-thumb { max-width: 210px; margin: 0 auto 18px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 3/4; }
.note-detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-info-rows { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 16px 0; }
.detail-info-row { display: flex; align-items: center; gap: 8px; background: #f7f9fd; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; font-weight: 500; min-width: 0; }
.detail-info-row .ic { font-size: 15px; flex-shrink: 0; }
.included-list { display: flex; flex-direction: column; gap: 9px; margin: 14px 0; }
.included-list .item { display: flex; gap: 9px; font-size: 14px; align-items: flex-start; min-width: 0; }
.included-list .item .tick { color: var(--success); flex-shrink: 0; }
.chapter-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.chapter-list .chap-row { display: flex; align-items: center; gap: 10px; background: #f7f9fd; border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13.5px; font-weight: 500; min-width: 0; }
.chapter-list .chap-row .num { width: 24px; height: 24px; border-radius: 50%; background: var(--blue-light); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex-shrink: 0; }
.chapter-list .chap-row .nm { flex: 1; min-width: 0; overflow-wrap: break-word; word-break: normal; white-space: normal; }
.chapter-list .chap-row .lock { color: var(--text-faint); font-size: 13px; flex-shrink: 0; }
.sticky-buy-bar {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--white);
  border-top: 1px solid var(--border); padding: 10px 16px calc(env(safe-area-inset-bottom,0px) + 10px);
  display: flex; align-items: center; gap: 12px; z-index: 95; box-shadow: 0 -6px 20px rgba(16,24,40,.08); min-width: 0;
}
.sticky-buy-bar .price-block { flex-shrink: 0; }
.sticky-buy-bar .price { font-size: 18px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.sticky-buy-bar .old-price { font-size: 11.5px; color: var(--text-faint); text-decoration: line-through; }
.sticky-buy-bar form, .sticky-buy-bar a.btn, .sticky-buy-bar button.btn { flex: 1; min-width: 0; }

/* ---------- Order summary / checkout ---------- */
.order-card { background: var(--white); border-radius: var(--radius-lg); padding: 16px 16px 8px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 12px; min-width: 0; }
.order-card .item-row { display: flex; gap: 12px; align-items: center; padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px dashed var(--border); min-width: 0; }
.order-card .item-row .thumb-sm { width: 52px; height: 66px; border-radius: 8px; background: var(--blue-light); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--blue); font-size: 20px; overflow: hidden; }
.order-card .item-row .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.order-card .item-row .info { flex: 1; min-width: 0; }
.order-card .item-row .title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-card .item-row .tag { font-size: 11px; color: var(--blue); font-weight: 600; }
.summary-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; min-width: 0; }
.summary-row.total { font-weight: 700; font-size: 16px; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 10px; }

/* ---------- Payment method list ---------- */
.pay-method { display: flex; align-items: center; gap: 12px; background: var(--white); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; font-weight: 500; font-size: 14px; }
.pay-method .icon { font-size: 20px; }

/* ---------- Status pages (success/failed) ---------- */
.status-page { text-align: center; padding-top: 44px; padding-bottom: 30px; }
.status-icon-wrap { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 40px; }
.status-icon-wrap.success { background: var(--success-bg); color: var(--success); }
.status-icon-wrap.failed { background: var(--danger-bg); color: var(--danger); }

/* ---------- Chapter download list (My Orders / Payment Success) ---------- */
.purchase-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 14px; overflow: hidden; min-width: 0; }
.purchase-card .ph { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); min-width: 0; }
.purchase-card .ph .thumb-sm { width: 46px; height: 58px; border-radius: 8px; background: var(--blue-light); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--blue); font-size: 18px; overflow: hidden; }
.purchase-card .ph .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.purchase-card .ph .meta { flex: 1; min-width: 0; }
.purchase-card .ph .meta .t { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.purchase-card .ph .meta .s { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.purchase-card .ph .amt { text-align: right; flex-shrink: 0; }
.purchase-card .ph .amt .p { font-weight: 700; font-size: 14px; color: var(--navy); }
.purchase-card .ph .amt .d { font-size: 10.5px; color: var(--text-muted); }
.purchase-card .chapters { padding: 6px 16px 14px; }
.chapter-dl-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f2f4f9; min-width: 0; }
.chapter-dl-row:last-child { border-bottom: none; }
.chapter-dl-row .dl-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--blue-light); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.chapter-dl-row .dl-info { flex: 1; min-width: 0; }
.chapter-dl-row .dl-info .nm { font-size: 13px; font-weight: 600; overflow-wrap: break-word; word-break: normal; white-space: normal; line-height: 1.4; }
.chapter-dl-row .dl-info .sub { font-size: 10.5px; color: var(--text-muted); }
.chapter-dl-row .btn { flex-shrink: 0; margin-top: 1px; }
.chapter-dl-row .locked { font-size: 12px; color: var(--text-faint); font-weight: 500; flex-shrink: 0; display: flex; align-items: center; gap: 5px; margin-top: 6px; }

/* ---------- Tables (admin) ---------- */
table.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; }
table.data-table th, table.data-table td { padding: 11px 13px; font-size: 13px; text-align: left; border-bottom: 1px solid #f0f2f7; }
table.data-table th { background: #f7f9fc; font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); }
table.data-table tbody tr:hover { background: #fafbff; }
.table-wrap { overflow-x: auto; }
.orders-desktop-table { display: none; }
.orders-mobile-cards { display: block; }
@media (min-width: 860px) {
  .orders-desktop-table { display: block; }
  .orders-mobile-cards { display: none; }
}

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-dark); color: #b9c8e6; padding: 34px 0 24px; margin-top: 30px; }
.footer-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.footer-grid h4 { color: var(--white); font-size: 14px; margin: 0 0 10px; }
.footer-grid a, .footer-grid p { font-size: 13px; color: #9fb4d8; display: block; margin-bottom: 8px; }
.footer-social { display: flex; gap: 12px; margin-top: 10px; }
.footer-social a { font-size: 18px; }
.footer-bottom { text-align: center; font-size: 12px; color: #7d8fb3; margin-top: 20px; border-top: 1px solid #16294a; padding-top: 16px; }

@media (min-width: 900px) {
  .nav-desktop { display: flex; }
  .hamburger { display: none; }
  .sticky-buy-bar { max-width: 1180px; left: 50%; transform: translateX(-50%); border-radius: var(--radius) var(--radius) 0 0; }
}

/* ==========================================================================
   ADMIN PANEL v2
   ========================================================================== */
.admin-body { background: #eef1f8; padding-bottom: 0; }
.admin-topbar {
  position: sticky; top: 0; z-index: 150; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 58px; box-shadow: 0 2px 12px rgba(7,20,41,.25);
}
.admin-topbar .logo { font-weight: 700; font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
.admin-topbar .logo img { width: 28px; height: 28px; border-radius: 50%; }
.admin-topbar .admin-hamburger { background: rgba(255,255,255,.08); border: none; color: #fff; font-size: 19px; width: 34px; height: 34px; border-radius: 9px; }
.admin-topbar .admin-user { font-size: 12.5px; display: flex; align-items: center; gap: 8px; color: #cfe0ff; }
.admin-topbar .admin-user .av { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.admin-layout { display: flex; min-height: calc(100vh - 58px); }
.admin-sidebar {
  width: 232px; background: linear-gradient(180deg, var(--navy-dark) 0%, #060f20 100%); color: #b9c8e6; flex-shrink: 0;
  position: fixed; top: 58px; bottom: 0; left: -250px; transition: left .22s; z-index: 160; overflow-y: auto;
  padding: 10px 0;
}
.admin-sidebar.open { left: 0; }
.admin-sidebar .sec-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #5c729e; padding: 14px 18px 6px; }
.admin-sidebar a { display: flex; align-items: center; gap: 11px; padding: 12px 18px; font-size: 14px; color: #b9c8e6; border-left: 3px solid transparent; font-weight: 500; }
.admin-sidebar a .ic { font-size: 16px; width: 20px; text-align: center; }
.admin-sidebar a.active { background: rgba(255,255,255,.06); color: #fff; border-left-color: var(--gold); }
.admin-sidebar a:hover { background: rgba(255,255,255,.05); color: #fff; }
.admin-main { flex: 1; padding: 18px 14px 46px; width: 100%; min-width: 0; }
.admin-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 155; }
.admin-overlay.open { display: block; }

@media (min-width: 900px) {
  .admin-hamburger { display: none; }
  .admin-sidebar { left: 0; position: sticky; top: 58px; height: calc(100vh - 58px); }
  .admin-main { padding: 26px; }
}

.admin-page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.admin-page-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 20px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); min-width: 0; }
.stat-card .icon { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-light); color: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 17px; margin-bottom: 10px; }
.stat-card .label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.stat-card .value { font-size: 21px; font-weight: 700; color: var(--navy); }

.admin-card { background: var(--white); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 18px; min-width: 0; }
.admin-card h3 { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .2px; }
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-pill.paid, .status-pill.active, .status-pill.completed { background: var(--success-bg); color: var(--success); }
.status-pill.pending { background: var(--warning-bg); color: var(--warning); }
.status-pill.failed, .status-pill.inactive, .status-pill.cancelled, .status-pill.blocked { background: var(--danger-bg); color: var(--danger); }

.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-form-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 700px) { .admin-form-row.two-col { grid-template-columns: 1fr 1fr; } }

/* Order cards (mobile-friendly alternative to wide tables) */
.order-admin-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.order-admin-card .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.order-admin-card .onum { font-weight: 700; font-size: 13.5px; }
.order-admin-card .odate { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.order-admin-card .ostudent { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.order-admin-card .oitems { font-size: 12px; color: var(--text-muted); background: #f7f9fd; border-radius: var(--radius-xs); padding: 8px 10px; margin-bottom: 10px; }
.order-admin-card .oamount { font-weight: 700; font-size: 15px; color: var(--navy); }
.order-admin-card .oactions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Chapter repeater (admin add/edit note) */
.chapter-repeater { display: flex; flex-direction: column; gap: 10px; }
.chapter-row { display: flex; gap: 10px; align-items: flex-start; background: #f7f9fd; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; min-width: 0; }
.chapter-row .chapter-num { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 4px; }
.chapter-row .chapter-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.chapter-row .chapter-remove { flex-shrink: 0; background: var(--danger-bg); color: var(--danger); border: none; width: 30px; height: 30px; border-radius: 50%; font-size: 15px; margin-top: 4px; }
.chapter-existing-file { font-size: 11.5px; color: var(--text-muted); background: var(--white); border: 1px dashed var(--border); border-radius: var(--radius-xs); padding: 7px 10px; display: flex; align-items: center; gap: 6px; }
.add-chapter-btn { align-self: flex-start; background: var(--blue-light); color: var(--blue); border: 1.5px dashed #b9cdfb; border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 600; font-size: 13.5px; }

/* Login (student + admin) full page background */
.center-page-bg { background: var(--navy-dark); min-height: 100vh; }
