/* =========================================================================
   PrepStation — Design System
   White + Dark Purple, app-first, mobile-primary.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Noto+Sans+Bengali:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #3B1B6B;
  --purple: #5B21B6;
  --violet: #7C3AED;
  --accent: #8B5CF6;
  --bg: #F7F5FA;
  --white: #FFFFFF;
  --text: #17131F;
  --muted: #6B6475;

  --gradient-brand: linear-gradient(135deg, var(--primary) 0%, var(--purple) 55%, var(--violet) 100%);
  --shadow-sm: 0 1px 3px rgba(59, 27, 107, 0.08);
  --shadow-md: 0 8px 24px rgba(59, 27, 107, 0.10);
  --shadow-lg: 0 16px 40px rgba(59, 27, 107, 0.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Hind Siliguri', 'Noto Sans Bengali', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 {
  font-family: 'Noto Sans Bengali', 'Hind Siliguri', sans-serif;
  margin: 0;
  color: var(--text);
}
p { margin: 0; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- App shell ------------------------------------------------------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  padding: 18px 18px calc(var(--nav-h) + 24px);
}

.no-nav .app-main { padding-bottom: 24px; }

/* Desktop: sidebar layout, keeps the same app identity */
@media (min-width: 960px) {
  body.has-shell { background: var(--primary); }
  .app-shell {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
    border-radius: 28px;
    overflow: hidden;
    min-height: 96vh;
    margin-top: 2vh;
  }
  .desktop-sidebar { display: flex; }
}

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--gradient-brand);
  color: var(--white);
  box-shadow: 0 10px 24px rgba(91, 33, 182, 0.30);
}
.btn-primary:hover { box-shadow: 0 14px 30px rgba(91, 33, 182, 0.38); }
.btn-outline {
  background: var(--white);
  color: var(--primary);
  border: 1.5px solid #E4DEF2;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding: 10px;
}
.btn-sm { padding: 10px 16px; font-size: 14px; width: auto; }

/* ---- Forms --------------------------------------------------------------- */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #E4DEF2;
  background: var(--white);
  font-size: 15.5px;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}
.field-error {
  color: #DC2626;
  font-size: 13px;
  margin-top: 6px;
}
.form-alert {
  background: #FDECEC;
  color: #B42318;
  border: 1px solid #F6C6C6;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.form-alert.success {
  background: #ECFBF3;
  color: #15803D;
  border-color: #BEEACD;
}

/* ---- Cards --------------------------------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

/* ---- Splash --------------------------------------------------------------- */
.splash-screen {
  min-height: 100vh;
  flex: 1;
  background: var(--gradient-brand);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
  text-align: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.splash-glow {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, transparent 70%);
  top: -120px;
  right: -140px;
  pointer-events: none;
}
.splash-logo {
  width: 128px;
  height: 128px;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.30);
  margin-bottom: 22px;
  animation: splashPop 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.splash-logo img { width: 100%; height: 100%; object-fit: cover; }
@keyframes splashPop {
  0% { opacity: 0; transform: scale(0.6) translateY(16px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.splash-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 0.5px;
  animation: splashFade 0.6s ease 0.25s both;
}
.splash-tagline {
  margin-top: 10px;
  font-size: 15px;
  opacity: 0.88;
  animation: splashFade 0.6s ease 0.4s both;
}
@keyframes splashFade {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.splash-loader {
  margin-top: 42px;
  width: 140px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
  animation: splashFade 0.6s ease 0.55s both;
}
.splash-loader-bar {
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: var(--white);
  animation: splashLoad 1.15s ease-in-out infinite;
}
@keyframes splashLoad {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ---- Auth screens ------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 22px;
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header .brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  overflow: hidden;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-md);
}
.auth-header .brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.auth-header h1 { font-size: 22px; font-weight: 700; }
.auth-header p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.auth-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 14.5px;
  color: var(--muted);
}
.auth-footer a { color: var(--violet); font-weight: 600; }
.divider-row {
  text-align: center;
  margin-top: 8px;
}

/* ---- Onboarding ---------------------------------------------------------- */
.onboard-wrap {
  min-height: 100vh;
  flex: 1;
  padding: 26px 20px 32px;
  display: flex;
  flex-direction: column;
}
.onboard-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 26px;
}
.onboard-progress span {
  flex: 1;
  height: 5px;
  border-radius: 4px;
  background: #E6E0F5;
  overflow: hidden;
}
.onboard-progress span.done, .onboard-progress span.active { background: var(--accent); }
.onboard-step h2 { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
.onboard-step > p { color: var(--muted); font-size: 14.5px; margin-bottom: 22px; }

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.choice-grid.single-col { grid-template-columns: 1fr; }
.choice-card {
  background: var(--white);
  border: 2px solid #E9E3F7;
  border-radius: var(--radius-md);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.choice-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.choice-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, #F4EEFE 0%, #FFFFFF 100%);
  box-shadow: var(--shadow-md);
}
.choice-card .emoji { font-size: 30px; margin-bottom: 10px; }
.choice-card .title { font-weight: 700; font-size: 16px; }
.choice-card .sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.onboard-actions {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  gap: 10px;
}
.onboard-actions .btn-outline { flex: 0 0 92px; }

/* ---- Top bar (app header) ------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 18px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo { width: 38px; height: 38px; border-radius: 11px; overflow: hidden; box-shadow: var(--shadow-sm); }
.topbar-logo img { width: 100%; height: 100%; object-fit: cover; }
.topbar-brand { font-weight: 800; font-size: 16px; color: var(--primary); letter-spacing: 0.2px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
  border: none;
  color: var(--primary);
  position: relative;
}
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #F04438; border: 1.5px solid var(--white);
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--gradient-brand);
  color: var(--white); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.avatar-lg { width: 68px; height: 68px; font-size: 22px; border-radius: 22px; }

/* ---- Dashboard greeting + stats ------------------------------------------ */
.greeting { margin-bottom: 16px; }
.greeting h1 { font-size: 21px; font-weight: 700; }
.greeting p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
.stat-chip {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 12px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-chip .val { font-size: 16px; font-weight: 800; color: var(--primary); }
.stat-chip .lbl { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 0 12px;
}
.section-head h3 { font-size: 15.5px; font-weight: 700; }
.section-head span { font-size: 12.5px; color: var(--violet); font-weight: 600; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.quick-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: none;
  font-family: inherit;
  transition: transform 0.15s ease;
}
.quick-card:active { transform: scale(0.95); }
.quick-card .ico { font-size: 22px; margin-bottom: 6px; }
.quick-card .lbl { font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.25; }

.exam-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.exam-scroll::-webkit-scrollbar { display: none; }
.exam-card {
  min-width: 210px;
  background: var(--gradient-brand);
  color: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.exam-card .tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(255,255,255,0.2);
  padding: 3px 9px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.exam-card h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 4px; }
.exam-card p { font-size: 12px; opacity: 0.85; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.tool-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: none;
  font-family: inherit;
}
.tool-card .ico {
  width: 40px; height: 40px;
  border-radius: 13px;
  background: #F1ECFB;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin: 0 auto 8px;
}
.tool-card .lbl { font-size: 11.5px; font-weight: 600; }

.subject-list { display: flex; flex-direction: column; gap: 10px; }
.subject-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.subject-card .ico {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--white);
  flex-shrink: 0;
}
.subject-card .info h4 { font-size: 14.5px; font-weight: 700; }
.subject-card .info p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.subject-card .chev { margin-left: auto; color: var(--muted); }

/* ---- Bottom nav ----------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  height: var(--nav-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid #ECE6F7;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  flex: 1;
  padding: 6px 0;
  border: none;
  background: transparent;
  font-family: inherit;
  transition: color 0.15s ease, transform 0.15s ease;
}
.nav-item .ico { font-size: 20px; transition: transform 0.15s ease; }
.nav-item.active { color: var(--primary); }
.nav-item.active .ico { transform: translateY(-2px); }
.nav-item:active { transform: scale(0.94); }

@media (min-width: 960px) {
  .bottom-nav { display: none; }
  .desktop-sidebar {
    display: none;
  }
}

/* ---- Under development ----------------------------------------------------- */
.ud-wrap {
  min-height: 100vh;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 26px;
}
.ud-wrap .brand-mark { width: 56px; height: 56px; border-radius: 16px; overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.ud-wrap .brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.ud-panda {
  width: 150px;
  margin-bottom: 8px;
  animation: udFloat 2.6s ease-in-out infinite;
}
@keyframes udFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.ud-wrap h2 { font-size: 20px; font-weight: 700; margin-top: 14px; }
.ud-wrap p { color: var(--muted); font-size: 14.5px; margin-top: 8px; line-height: 1.5; }
.ud-wrap .btn { margin-top: 26px; max-width: 240px; }

/* ---- Toast ------------------------------------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px);
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--white);
  padding: 13px 20px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ---- Panda mascot experience -------------------------------------------- */
.panda-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}
.panda-stage {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translate(-50%, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
}
.panda-stage.enter {
  animation: pandaFall 0.9s cubic-bezier(0.34, 1.35, 0.42, 1) forwards;
}
@keyframes pandaFall {
  0%   { opacity: 0; transform: translate(-50%, -260px) scale(0.85) rotate(-6deg); }
  60%  { opacity: 1; transform: translate(-50%, 12px) scale(1.04) rotate(3deg); }
  80%  { transform: translate(-50%, -8px) scale(0.98) rotate(-2deg); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0deg); }
}
.panda-stage.leave {
  animation: pandaLeave 0.5s ease forwards;
}
@keyframes pandaLeave {
  0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 40px) scale(0.6); }
}
.panda-shadow {
  width: 64px; height: 12px;
  border-radius: 50%;
  background: rgba(59,27,107,0.18);
  margin-top: -6px;
  filter: blur(1px);
  animation: shadowPulse 0.9s ease forwards;
}
@keyframes shadowPulse {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.15); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}
.panda-figure {
  font-size: 84px;
  line-height: 1;
  filter: drop-shadow(0 10px 16px rgba(59,27,107,0.25));
  animation: pandaBreathe 2.4s ease-in-out infinite 1s;
  pointer-events: auto;
}
@keyframes pandaBreathe {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-2deg); }
}
.panda-bubble {
  background: var(--white);
  color: var(--text);
  border-radius: 18px;
  padding: 14px 16px;
  max-width: 260px;
  margin-top: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: auto;
}
.panda-bubble.show {
  animation: bubbleIn 0.35s ease forwards;
}
@keyframes bubbleIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.panda-bubble .btn { margin-top: 12px; }
.panda-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 19, 31, 0.28);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}
.panda-backdrop.show { opacity: 1; }

/* ---- Profile ------------------------------------------------------------- */
.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0 22px;
}
.profile-head h2 { font-size: 19px; font-weight: 700; margin-top: 12px; }
.profile-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.info-row .k { font-size: 13px; color: var(--muted); }
.info-row .v { font-size: 14.5px; font-weight: 600; }

/* ---- Utility --------------------------------------------------------------- */
.hidden { display: none !important; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
