/* =========================================================
   PAT PAT IELTS — App styles (Lộ trình · Unit · Ôn tập · Khoá học · Giới thiệu)
   Brand: hồng #c06987 + trắng, nhấn xanh cobalt (sách IELTS của mascot)
   ========================================================= */
:root {
  --rose: #c06987;
  --rose-ink: #a45a73; /* --rose darkened to 4.5:1 on white and --rose-50: text and white-text buttons */
  --rose-dark: #9e4b67;
  --rose-deep: #8b3250;
  --rose-50: #fdf3f7;
  --rose-100: #f8e3eb;
  --rose-200: #efc6d5;
  --cobalt: #1f3fc4;
  --cobalt-50: #eef1ff;
  --ink: #1e293b;
  --ink-2: #334155;
  --muted: #5b6a7f; /* 4.5:1 on the tinted backgrounds too */
  --subtle: #94a3b8;
  --line: #edf0f5;
  --line-2: #e2e8f0;
  --bg: #f5f6fa;
  --card: #ffffff;
  --green: #15803d;
  --green-50: #ecfdf3;
  --red: #e5484d;
  --red-50: #fff1f2;
  --red-ink: #c0262d; /* red text */
  --gold: #f59e0b;
  --gold-50: #fff7e6;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 6px 22px rgba(30, 41, 59, .05);
  --shadow-lg: 0 18px 40px rgba(158, 75, 103, .16);
  --sidebar-w: 184px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea, select { font: inherit; color: inherit; }
[data-lucide], .lucide { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
:focus-visible { outline: 2.5px solid var(--cobalt); outline-offset: 2px; border-radius: 8px; }

/* ───────── Shell ───────── */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  position: sticky; top: 0; height: 100vh;
  background: #b25875 url('pink-bg-1200.webp') center / cover no-repeat;
  display: flex; flex-direction: column; padding: 24px 0 20px; z-index: 50;
  box-shadow: none;
}
.sidebar::before { content: ''; position: absolute; inset: 0; background: rgba(168,77,106,.35); pointer-events: none; }
.sidebar > * { position: relative; z-index: 1; }
.sb-logo { padding: 0 20px 26px; display: block; }
.sb-logo img { width: 64px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.sb-menu { list-style: none; display: flex; flex-direction: column; gap: 10px; padding-left: 14px; flex: 1; }
.sb-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  color: rgba(255,255,255,.92); font-size: 14.5px; font-weight: 600;
  border-radius: 16px 0 0 16px; position: relative; transition: background .2s;
}
.sb-item:hover:not(.active) { background: rgba(255,255,255,.13); color: #fff; }
.sb-item.active { background: var(--bg); color: #9a3b5a; font-weight: 700; border-radius: 20px 0 0 20px; margin-right: 0; }
/* góc cong nối tab active với vùng nội dung */
.sb-foot { padding: 0 16px; }
.sb-mascot { width: 118px; margin: 0 auto 10px; opacity: .96; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.sb-cta { display: none; align-items: center; justify-content: center; gap: 6px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 999px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; }
.sb-cta:hover { background: rgba(255,255,255,.28); }

.main { flex: 1; min-width: 0; padding: 22px 28px 48px; max-width: 1440px; margin: 0 auto; width: 100%; }
.topbar {
  display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 18px;
  padding: 12px 16px 12px 22px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.topbar h1 { font-family: var(--display); font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin-right: auto; display: flex; align-items: center; gap: 10px; }
.topbar .crumb { font-size: 13px; font-weight: 500; color: var(--muted); }
.tb-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 7px 12px; border-radius: 999px; background: var(--bg); font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.tb-chip .lucide { width: 16px; height: 16px; }
.tb-chip.coin { background: var(--gold-50); color: #a16207; }
.tb-chip.fire { background: var(--rose-50); color: var(--rose-dark); }
.tb-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--rose-100); padding: 0; overflow: hidden; flex-shrink: 0; transition: transform .2s; }
.tb-avatar:hover { transform: scale(1.06); border-color: var(--rose-200); }
.tb-avatar svg { width: 100%; height: 100%; display: block; }
button.tb-chip { cursor: pointer; } button.tb-chip:hover { filter: brightness(.97); }
.av-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.av-opt { border-radius: 50%; padding: 4px; border: 3px solid transparent; transition: transform .2s; }
.av-opt:hover { transform: scale(1.05); } .av-opt.on { border-color: var(--rose); }
.av-opt svg { width: 100%; display: block; }
.price-list { display: flex; flex-direction: column; gap: 8px; }
.price-list div { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 11px 14px; border-radius: 12px; background: var(--bg); font-size: 14px; }
.price-list span { display: inline-flex; gap: 8px; align-items: center; } .price-list b { color: #a16207; white-space: nowrap; }
.earn-list { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.sel-pop { position: absolute; z-index: 350; width: 270px; background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.18); padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); animation: pop .2s ease; }
.sel-pop[hidden] { display: none; }
.sel-pop b { font-size: 15px; color: var(--rose-dark); }
.sel-pop .input { padding: 8px 10px; font-size: 13.5px; }
.tb-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 7px 10px; border-radius: 10px; }
.tb-link:hover { background: var(--bg); color: var(--ink); }

/* ───────── Primitives ───────── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h2, .card-h h3 { font-family: var(--display); font-size: 16.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-h a, .link-more { font-size: 12.5px; color: var(--muted); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; min-height: 40px; }
.card-h a:hover, .link-more:hover { color: var(--rose-dark); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--rose-ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: 14.5px; transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--rose-ink); color: #fff; box-shadow: 0 6px 16px rgba(192,105,135,.32); }
.btn-primary:hover { background: var(--rose-dark); }
.btn-white { background: #fff; color: var(--rose-dark); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.btn-ghost { background: var(--bg); color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-outline { border: 1.5px solid var(--rose-200); color: var(--rose-dark); background: #fff; }
.btn-outline:hover { background: var(--rose-50); }
.btn-cobalt { background: var(--cobalt); color: #fff; box-shadow: 0 6px 16px rgba(31,63,196,.25); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--ink-2); }
.pill.rose { background: var(--rose-50); color: var(--rose-dark); }
.pill.cobalt { background: var(--cobalt-50); color: var(--cobalt); }
.pill.green { background: var(--green-50); color: var(--green); }
.pill.gold { background: var(--gold-50); color: #a16207; }
.pill .lucide { width: 14px; height: 14px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #fff; border-radius: 999px; box-shadow: var(--shadow); flex-wrap: wrap; }
.tab { min-height: 40px; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--rose-ink); color: #fff; box-shadow: 0 4px 12px rgba(192,105,135,.3); }
.tab .count { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 7px; font-size: 11.5px; }
.tab.active .count { background: #fff; color: var(--rose-ink); }

.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), #d98aa5); border-radius: inherit; transition: width .5s ease; }

.icon-tile { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--rose-50); color: var(--rose-dark); flex-shrink: 0; }
.icon-tile.cobalt { background: var(--cobalt-50); color: var(--cobalt); }
.icon-tile.green { background: var(--green-50); color: var(--green); }
.icon-tile.gold { background: var(--gold-50); color: #b45309; }
.icon-tile .lucide { width: 21px; height: 21px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input { width: 100%; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 11px 14px; background: #fff; font-size: 15px; transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: 2px solid var(--rose-ink); outline-offset: 2px; border-color: var(--rose); }
.chip-f { min-height: 40px; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chip-f:hover { background: var(--bg); }
.chip-f.on { background: var(--rose-50); color: var(--rose-dark); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.6; }

/* ───────── Modal ───────── */
.modal-bg { position: fixed; inset: 0; background: rgba(30,20,26,.45); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 200; }
.modal-bg.open { display: flex; animation: fadeIn .2s ease; }
.modal { background: #fff; border-radius: 24px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; position: relative; box-shadow: 0 30px 80px rgba(0,0,0,.25); animation: pop .28s cubic-bezier(.2,.9,.3,1.2); }
.modal-x { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); z-index: 2; }
.modal-x:hover { background: var(--line-2); }
@keyframes fadeIn { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97) } }

/* ───────── Toast ───────── */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 300; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 16px; padding: 10px 16px 10px 10px; box-shadow: 0 14px 34px rgba(0,0,0,.14); font-size: 14px; font-weight: 600; max-width: 340px; animation: toastIn .35s cubic-bezier(.2,.9,.3,1.3); }
.toast img { width: 44px; height: 44px; object-fit: contain; }
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) } }
.coin-fly { position: fixed; z-index: 400; font-weight: 800; color: #b45309; background: var(--gold-50); border-radius: 999px; padding: 4px 10px; font-size: 14px; pointer-events: none; animation: coinFly 1.1s ease-out forwards; box-shadow: 0 4px 12px rgba(245,158,11,.3); }
@keyframes coinFly { 0% { opacity: 0; transform: translateY(10px) scale(.8) } 20% { opacity: 1; transform: translateY(0) scale(1.1) } 100% { opacity: 0; transform: translateY(-60px) } }

/* ───────── Mascot helpers ───────── */
.float { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) } }
.wiggle:hover { animation: wiggle .5s ease; }
@keyframes wiggle { 25% { transform: rotate(-4deg) } 75% { transform: rotate(4deg) } }
.empty { text-align: center; padding: 34px 20px; }
.empty img { width: 150px; margin: 0 auto 12px; }
.empty h3 { font-family: var(--display); font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 380px; margin: 0 auto 16px; }

/* ───────── Responsive shell ───────── */
@media (max-width: 860px) {
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: 100%; height: 66px; flex-direction: row; padding: 0; background-size: cover; box-shadow: 0 -4px 18px rgba(0,0,0,.1); }
  .sb-logo, .sb-foot { display: none; }
  .sb-menu { flex-direction: row; padding: 0 6px; gap: 0; justify-content: space-around; align-items: center; width: 100%; }
  .sb-menu li { flex: 1; }
  .sb-item { flex-direction: column; gap: 2px; font-size: 11.5px; padding: 8px 2px; border-radius: 14px; text-align: center; }
  .sb-item.active { border-radius: 14px; }
  .sb-item.active::before, .sb-item.active::after { display: none; }
  .sb-item.active { background: #fff; }
  .main { padding: 14px 16px 90px; }
  .topbar { padding: 10px 12px 10px 16px; gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .tb-link, .topbar .crumb { display: none; }
  .tb-chip { padding: 6px 9px; font-size: 12px; }
  .toast-wrap { bottom: 80px; right: 12px; left: 12px; }
}
@media (max-width: 420px) { .tb-avatar { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ───────── B9: trang đăng nhập & trạng thái lỗi/khoá ───────── */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 120% at 0% 0%, #fdf3f7 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 430px; background: var(--card); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 30px 28px; }
.auth-card .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-card .logo img { width: 54px; }
.auth-card h1 { font-family: var(--display); font-size: 22px; font-weight: 800; line-height: 1.25; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 4px 0 18px; }
[hidden] { display: none !important; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { width: 100%; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; margin-top: 14px; }
.auth-links a, .auth-links button { color: var(--rose-dark); font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.form-msg { font-size: 13.5px; border-radius: 12px; padding: 10px 12px; }
.form-msg[hidden] { display: none; }
.form-msg.err { background: var(--red-50); color: #b4232a; }
.form-msg.ok { background: var(--green-50); color: #15803d; }
.form-msg button { color: inherit; font-weight: 800; text-decoration: underline; }
.state-box { text-align: center; padding: 40px 20px; }
.state-box h3 { font-family: var(--display); font-size: 18px; margin-bottom: 6px; }
.state-box p { color: var(--muted); font-size: 14px; max-width: 420px; margin: 0 auto 14px; }
.state-box .rid { font-size: 11.5px; color: var(--muted); margin-top: 10px; word-break: break-all; }
.state-box img { width: 130px; margin: 0 auto 12px; }
.skeleton { background: linear-gradient(90deg, var(--line) 25%, var(--line-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: skel 1.2s infinite; border-radius: 14px; min-height: 18px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
