/* ====================================================================
   Autom8Task Training — styles  (brand: Sora + #3C3489)
   ==================================================================== */
:root {
  --brand: #3C3489;
  --brand-dark: #2A2463;
  --brand-soft: #EFEEF8;
  --ink: #211D3D;
  --body: #3a3658;
  --muted: #6B6786;
  --line: #E2DFF1;
  --bg: #F1F0F7;
  --white: #fff;
  --ok: #1Fa971;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(60, 52, 137, .12);
  --font: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* ---- shared brand bits ------------------------------------------- */
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--brand); color: #fff;
  font-weight: 800; font-size: 15px; letter-spacing: .3px;
  flex: 0 0 auto;
}
.brand__name { font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: .2px; }
.brand__name b { color: var(--brand); }

/* ====================================================================
   LOGIN SCREEN
   ==================================================================== */
.login {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(1100px 480px at 50% -10%, rgba(60,52,137,.18), transparent 70%),
    var(--bg);
}
.login__card {
  width: 100%; max-width: 420px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 36px 32px 30px;
  text-align: center;
}
.login__brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login__title { margin: 0 0 6px; font-size: 22px; color: var(--ink); font-weight: 700; }
.login__sub { margin: 0 0 26px; font-size: 14px; color: var(--muted); line-height: 1.5; }

.field { text-align: left; margin-bottom: 16px; }
.field label {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--brand); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 13px 14px;
  font-family: var(--font); font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; background: #fbfbfe;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(60,52,137,.14);
}
.field__hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.btn {
  font-family: var(--font); font-weight: 700; cursor: pointer;
  border: none; border-radius: 10px; transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--block { width: 100%; padding: 14px; font-size: 15px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.login__error {
  margin: 0 0 16px; padding: 11px 14px;
  background: #FDECEC; border: 1px solid #F5C2C2; border-radius: 10px;
  color: #B42318; font-size: 13px; text-align: left;
}
.login__foot { margin: 22px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.login__foot a { color: var(--brand); }

/* ====================================================================
   APP / PORTAL
   ==================================================================== */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.topbar__brand { display: inline-flex; align-items: center; gap: 10px; }
.topbar__spacer { flex: 1; }
.topbar__who { font-size: 13px; color: var(--muted); }
.topbar__who b { color: var(--ink); font-weight: 700; }
.btn--ghost {
  background: transparent; color: var(--brand);
  border: 1.5px solid var(--line); padding: 8px 14px; font-size: 13px;
}
.btn--ghost:hover { border-color: var(--brand); }

.drawer-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--brand-soft); border: none; cursor: pointer;
}
.drawer-toggle span, .drawer-toggle span::before, .drawer-toggle span::after {
  content: ''; display: block; width: 18px; height: 2px; background: var(--brand); border-radius: 2px; position: relative;
}
.drawer-toggle span::before { position: absolute; top: -6px; }
.drawer-toggle span::after { position: absolute; top: 6px; }

.layout { flex: 1; display: grid; grid-template-columns: 320px 1fr; align-items: start; }

/* ---- sidebar ----------------------------------------------------- */
.sidebar {
  position: sticky; top: 65px; align-self: start;
  height: calc(100vh - 65px); overflow-y: auto;
  background: var(--white); border-right: 1px solid var(--line);
  padding: 20px 14px;
}
.sidebar__head { padding: 0 8px 14px; }
.sidebar__title { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--brand); }
.progress { }
.progress__bar { height: 8px; background: var(--brand-soft); border-radius: 999px; overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #6A5FD0); border-radius: 999px; transition: width .35s ease; }
.progress__text { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.module-list { list-style: none; margin: 10px 0 0; padding: 0; }
.module-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 10px; border-radius: 10px; cursor: pointer;
  transition: background .12s;
}
.module-item:hover { background: var(--brand-soft); }
.module-item.is-active { background: var(--brand-soft); }
.module-item.is-active .module-item__title { color: var(--brand); font-weight: 700; }

.module-item__check {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
}
.module-item.is-done .module-item__check { background: var(--ok); border-color: var(--ok); }
.module-item.is-done .module-item__check::after {
  content: '✓'; color: #fff; font-size: 12px; font-weight: 800; line-height: 1;
}
.module-item__label { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.module-item__num { flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--muted); width: 18px; }
.module-item__title { font-size: 13.5px; color: var(--body); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; }
.module-item__dur { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- main lesson ------------------------------------------------- */
.content { padding: 28px clamp(16px, 4vw, 48px) 60px; }
.lesson { max-width: 880px; margin: 0 auto; }
.lesson__eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--brand); margin: 0 0 8px; }
.lesson__title { margin: 0 0 18px; font-size: clamp(22px, 3.4vw, 30px); line-height: 1.2; color: var(--ink); font-weight: 800; }

.video-wrap {
  position: relative; background: #000;
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); aspect-ratio: 16 / 9;
}
.video-wrap video { width: 100%; height: 100%; display: block; background: #000; }

/* ---- view toggle (video / guide) --------------------------------- */
.seg {
  display: inline-flex; gap: 4px; margin: 0 0 16px;
  background: var(--brand-soft); border-radius: 11px; padding: 4px;
}
.seg__btn {
  font-family: var(--font); font-size: 13.5px; font-weight: 700; cursor: pointer;
  border: none; background: transparent; color: var(--brand);
  padding: 8px 16px; border-radius: 8px; transition: background .12s, color .12s;
}
.seg__btn.is-active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(60,52,137,.18); }

/* ---- guide (embedded HTML page) ---------------------------------- */
.guide-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--brand-soft);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.guide-bar__label { font-size: 13px; font-weight: 700; color: var(--brand); }
.guide-bar__open { font-size: 13px; font-weight: 700; color: var(--brand); text-decoration: none; }
.guide-bar__open:hover { text-decoration: underline; }
.guide-frame {
  width: 100%; height: 78vh; min-height: 460px; display: block;
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
}

/* ---- empty state ------------------------------------------------- */
.empty {
  aspect-ratio: 16 / 9; display: grid; place-content: center; text-align: center;
  background: var(--brand-soft); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty__title { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: var(--brand); }
.empty__sub { margin: 0; font-size: 14px; color: var(--muted); }

.lesson__summary { margin: 22px 0 0; font-size: 15.5px; line-height: 1.7; color: var(--body); }

.lesson__actions {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line);
}
.lesson__actions .spacer { flex: 1; }
.btn--nav { background: var(--brand-soft); color: var(--brand); padding: 11px 18px; font-size: 14px; }
.btn--nav:hover:not([disabled]) { background: #E3E0F5; }
.btn--complete { background: var(--brand); color: #fff; padding: 11px 20px; font-size: 14px; }
.btn--complete.is-done { background: var(--ok); }

/* ---- mobile drawer scrim ----------------------------------------- */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(33,29,61,.45);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 25;
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */
@media (max-width: 860px) {
  .drawer-toggle { display: inline-flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 40;
    width: 300px; max-width: 84vw; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 50px rgba(0,0,0,.2);
  }
  body.drawer-open .sidebar { transform: translateX(0); }
  body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
  .topbar__who { display: none; }
}
