/* =========================================================================
   S-2 Personality Development Platform — design system
   "Career mode" — deeper navy + amber, more directed than S-1's saffron warmth.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --paper: #FAF6EE;
  --paper-2: #F4EFE2;
  --ink: #131A33;
  --ink-soft: #2A3358;
  --amber: #C77B2A;
  --amber-deep: #A36110;
  --teal: #3B7A77;
  --teal-light: #8DBDB9;
  --rose: #B43A4F;
  --emerald: #4E7C4A;
  --muted: #6B7280;
  --rule: #DAD2BD;
  --rule-soft: #EAE3D0;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(19,26,51,.05);
  --shadow-md: 0 4px 14px rgba(19,26,51,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 2.1rem; line-height: 1.15; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; font-weight: 600; }

a { color: var(--amber-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: 'JetBrains Mono', monospace; font-size: .9em; }

/* =========================================================================
   AUTH PAGE (index.html)
   ========================================================================= */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--paper);
}
@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } }

.auth-hero {
  background: var(--ink);
  color: var(--paper);
  padding: 3rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(900px 600px at -10% 110%, rgba(199,123,42,.18), transparent 60%),
              radial-gradient(700px 500px at 110% -10%, rgba(59,122,119,.15), transparent 55%);
  pointer-events: none;
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .eyebrow { font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: var(--amber); margin-bottom: .8rem; }
.auth-hero h1 { color: var(--paper); font-size: 2.6rem; line-height: 1.1; margin-bottom: 1rem; }
.auth-hero h1 em { font-style: italic; color: var(--amber); font-weight: 400; }
.auth-hero p.lead { color: var(--paper-2); font-size: 1.05rem; max-width: 30rem; opacity: .85; }
.auth-hero .footer { font-size: .8rem; opacity: .55; }
.auth-hero ul.points { list-style: none; padding: 0; margin: 1.5rem 0 0; max-width: 32rem; }
.auth-hero ul.points li { padding: .4rem 0; border-bottom: 1px solid rgba(255,255,255,.08); font-size: .95rem; opacity: .85; }
.auth-hero ul.points li::before { content: "→"; color: var(--amber); margin-right: .6rem; font-weight: 600; }

.auth-form-side {
  padding: 3rem 3.5rem;
  display: flex; flex-direction: column; justify-content: center;
}
.auth-tabs { display: flex; gap: 1rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--rule); }
.auth-tab { padding: .6rem 0; background: transparent; border: 0; cursor: pointer;
  font-size: .95rem; color: var(--muted); border-bottom: 2px solid transparent; margin-right: 1rem; font-weight: 500;
  font-family: inherit;
}
.auth-tab.active { color: var(--ink); border-bottom-color: var(--amber); }

.form-row { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-row label { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.form-row label .hint { font-weight: 400; color: var(--muted); display: block; margin-top: .15rem; font-size: .78rem; }
.form-row input, .form-row select, .form-row textarea {
  background: var(--white); border: 1px solid var(--rule); border-radius: 5px;
  padding: .7rem .9rem; font-family: inherit; font-size: .95rem; color: var(--ink);
  transition: border-color .15s ease;
}
.form-row textarea { min-height: 4.5rem; resize: vertical; line-height: 1.5; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--amber);
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-grid-2 { grid-template-columns: 1fr; } }

.form-error { color: var(--rose); background: #FCE6E9; padding: .6rem .8rem; border-radius: 4px; font-size: .85rem; margin-bottom: 1rem; }

.btn {
  background: var(--ink); color: var(--paper); border: 0; padding: .75rem 1.4rem;
  border-radius: 4px; font-family: inherit; font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .15s; display: inline-flex; align-items: center; gap: .5rem;
}
.btn:hover { background: var(--ink-soft); }
.btn:disabled { background: #999; cursor: not-allowed; }
.btn.btn-primary { background: var(--amber); }
.btn.btn-primary:hover { background: var(--amber-deep); }
.btn.btn-teal { background: var(--teal); }
.btn.btn-teal:hover { background: #2C5E5B; }
.btn.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn.btn-ghost:hover { background: var(--paper-2); }
.btn.btn-danger { background: var(--rose); }
.btn.btn-danger:hover { background: #8B2D3D; }
.btn.btn-sm { padding: .35rem .75rem; font-size: .82rem; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app-page #app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .app-page #app-shell { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
  padding: 1.4rem 1rem 1rem;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { padding: 0 .5rem 1rem; border-bottom: 1px solid var(--rule); margin-bottom: 1rem; }
.sidebar .brand-head { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 600; color: var(--ink); }
.sidebar .brand-head em { font-style: italic; color: var(--amber-deep); font-weight: 400; }
.sidebar .brand-sub { font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 1.2rem; padding-top: .5rem; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); padding: 0 .5rem .25rem; }
.nav-link {
  display: flex; align-items: center; padding: .5rem .75rem;
  color: var(--ink); border-radius: 4px; font-size: .9rem; line-height: 1.3;
  transition: background .12s;
}
.nav-link:hover { background: rgba(19,26,51,.06); text-decoration: none; }
.nav-link.active { background: var(--ink); color: var(--paper); font-weight: 500; }
.nav-link .module-num { font-family: 'JetBrains Mono', monospace; font-size: .78rem; color: var(--amber-deep); margin-right: .55rem; min-width: 1rem; }
.nav-link.active .module-num { color: var(--amber); }

.sidebar-foot { border-top: 1px solid var(--rule); padding: .8rem .5rem 0; margin-top: .5rem; }
.sidebar-foot .user-card { display: flex; align-items: center; gap: .65rem; margin-bottom: .7rem; }
.sidebar-foot .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--amber);
  color: var(--white); display: grid; place-items: center; font-weight: 600;
}
.sidebar-foot .user-name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.sidebar-foot .user-role { font-size: .72rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }

/* MAIN */
.main {
  padding: 2rem 2.6rem 4rem;
  max-width: 1100px;
  width: 100%;
}
@media (max-width: 700px) { .main { padding: 1.5rem 1.2rem 3rem; } }

.page-head { margin-bottom: 1.6rem; }
.page-head .eyebrow { font-size: .72rem; letter-spacing: .25em; text-transform: uppercase; color: var(--amber-deep); font-weight: 600; }
.page-head h1 { font-size: 2.1rem; margin: .4rem 0 .2rem; }
.page-head .subtitle { color: var(--muted); font-size: 1rem; font-style: italic; }

/* CARDS */
.card { background: var(--white); border: 1px solid var(--rule); border-radius: 6px; padding: 1.4rem 1.6rem; margin-bottom: 1.2rem; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--rule-soft); }
.card-head h3 { margin: 0; }
.card.tight { padding: 1rem 1.2rem; }

/* GRID/LAYOUT */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.gap-sm { gap: .5rem; }
.row.gap-md { gap: 1rem; }

.mt-sm { margin-top: .5rem; } .mt-md { margin-top: 1rem; } .mt-lg { margin-top: 1.6rem; }
.mb-sm { margin-bottom: .5rem; } .mb-md { margin-bottom: 1rem; } .mb-lg { margin-bottom: 1.6rem; }

/* STATS */
.stat-card { background: var(--white); border: 1px solid var(--rule); border-radius: 6px; padding: 1.1rem 1.2rem; }
.stat-label { font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); margin-bottom: .25rem; }
.stat-value { font-family: 'Fraunces', serif; font-size: 2.2rem; font-weight: 500; color: var(--ink); line-height: 1; }
.stat-sub { font-size: .8rem; color: var(--muted); margin-top: .35rem; }

/* CONTENT BOXES (faculty / dialogue / drill / sample / exercise / key) */
.box { padding: .9rem 1.1rem; margin: .8rem 0; border-radius: 0 4px 4px 0; font-size: .92rem; }
.box .box-title { font-weight: 700; font-size: .72rem; letter-spacing: .15em; text-transform: uppercase; margin-bottom: .35rem; }
.box.faculty { background: #FFF7E6; border-left: 4px solid #F2A93B; color: #6B4F08; }
.box.dialogue { background: #F0E7FA; border-left: 4px solid #7B4FB8; color: #3F2278; }
.box.drill { background: #E3F4F2; border-left: 4px solid #3B7A77; color: #1B3F3D; }
.box.sample { background: #F2F0E8; border-left: 4px solid #6B7280; color: #2E3138; }
.box.exercise { background: #E8F4E4; border-left: 4px solid #4E7C4A; color: #1F3D1E; }
.box.key { background: #FBE6EA; border-left: 4px solid #B43A4F; color: #5E1B26; }
.box ul, .box ol { margin: .4rem 0 0; padding-left: 1.3rem; }
.box li { margin-bottom: .2rem; }
.box .box-title { color: inherit; }

/* SUBTABS */
.subtabs { display: flex; gap: .1rem; border-bottom: 1px solid var(--rule); margin-bottom: 1.4rem; }
.subtab { padding: .55rem 1rem; font-size: .9rem; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.subtab:hover { color: var(--ink); text-decoration: none; }
.subtab.active { color: var(--ink); border-bottom-color: var(--amber); font-weight: 600; }

/* CHIPS */
.chip { display: inline-block; padding: .15rem .55rem; font-size: .72rem; border-radius: 2px; font-weight: 600; letter-spacing: .05em; }
.chip.amber { background: #FFE7C6; color: var(--amber-deep); }
.chip.teal  { background: #DAE9E7; color: var(--teal); }
.chip.rose  { background: #FBE6EA; color: var(--rose); }
.chip.emerald { background: #DEEED9; color: var(--emerald); }
.chip.ink   { background: var(--ink); color: var(--paper); }

/* TABLES */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--rule-soft); }
.tbl th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.tbl tr:hover td { background: var(--paper); }

/* MCQ */
.mcq-q { background: var(--white); border: 1px solid var(--rule); border-radius: 4px; padding: 1rem 1.2rem; margin-bottom: .8rem; }
.mcq-q .q-text { font-weight: 500; margin-bottom: .7rem; }
.mcq-opt { display: flex; align-items: flex-start; gap: .55rem; padding: .35rem .55rem; border-radius: 3px; cursor: pointer; }
.mcq-opt:hover { background: var(--paper); }
.mcq-opt input { margin-top: 4px; }
.mcq-opt.correct { background: #DEEED9; }
.mcq-opt.wrong { background: #FBE6EA; }
.mcq-explain { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--amber); padding-left: .75rem; margin-top: .55rem; font-style: italic; }

/* MISC */
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.x-small { font-size: .75rem; }
hr.rule { border: 0; border-top: 1px solid var(--rule); margin: 1.6rem 0; }
.word-count { font-size: .75rem; color: var(--muted); margin-top: .25rem; }

/* PILLS for sub-options */
.pill-group { display: inline-flex; gap: 4px; }
.pill { padding: .35rem .8rem; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 99px; cursor: pointer; font-size: .82rem; font-weight: 500; }
.pill.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pill:hover { background: var(--paper); }
.pill.active:hover { background: var(--ink-soft); }

/* MODAL */
.modal-back {
  position: fixed; inset: 0; background: rgba(19,26,51,.55);
  display: grid; place-items: center; z-index: 100; padding: 1rem;
}
.modal {
  background: var(--white); border-radius: 8px; max-width: 720px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 1.5rem 1.8rem;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule); padding-bottom: .8rem; margin-bottom: 1.2rem; }
.modal-close { background: transparent; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--muted); }

/* TOAST */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1.1rem; border-radius: 5px;
  font-size: .9rem; z-index: 200; box-shadow: var(--shadow-md);
  animation: toast-in .2s ease;
}
.toast.error { background: var(--rose); }
.toast.success { background: var(--emerald); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* PROGRESS BAR */
.bar { height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--amber); border-radius: 99px; transition: width .3s ease; }
.bar.teal > div { background: var(--teal); }
.bar.emerald > div { background: var(--emerald); }

ul.tidy { padding-left: 1.1rem; margin: .5rem 0; }
ul.tidy li { margin-bottom: .25rem; }

/* GRID for module list */
.module-tile { background: var(--white); border: 1px solid var(--rule); padding: 1rem 1.2rem; border-radius: 4px; transition: box-shadow .15s; cursor: pointer; display: flex; gap: 1rem; align-items: flex-start; }
.module-tile:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.module-tile .num { font-family: 'Fraunces', serif; font-size: 2rem; color: var(--amber); line-height: 1; min-width: 2.5rem; }
.module-tile .body strong { display: block; margin-bottom: .25rem; }
.module-tile .body .sub { font-size: .82rem; color: var(--muted); }
.module-tile .body .hrs { font-size: .72rem; color: var(--amber-deep); letter-spacing: .1em; text-transform: uppercase; margin-top: .25rem; }

/* STUDENT TILE for trainer view */
.student-tile { background: var(--white); border: 1px solid var(--rule); padding: .9rem 1.1rem; border-radius: 4px; cursor: pointer; transition: box-shadow .15s; }
.student-tile:hover { box-shadow: var(--shadow-md); }
.student-tile .name { font-weight: 600; }
.student-tile .meta { font-size: .8rem; color: var(--muted); margin-top: .2rem; }

/* responsive */
@media (max-width: 900px) {
  .sidebar { height: auto; position: relative; padding: 1rem; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: .4rem; padding-top: 0; }
  .nav-group { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-group-label { display: none; }
  .sidebar-foot { padding-top: .5rem; }
}
