/* ============================================================
   NEXIS POWER ACADEMY — Brand Design System
   ============================================================ */

:root {
  --nexis-orange: #FFA501;
  --nexis-orange-2: #FF8501;
  --nexis-charcoal: #2B3D4A;
  --nexis-blue: #445A7D;
  --nexis-white: #FAFAF6;

  --ink: #1B2530;
  --ink-soft: #4B5A66;
  --ink-faint: #7C8A94;
  --border: #E4E4DC;
  --surface: #FFFFFF;
  --surface-sunk: #F3F3EE;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(43,61,74,0.08), 0 1px 2px rgba(43,61,74,0.06);
  --shadow-md: 0 6px 20px rgba(43,61,74,0.10), 0 2px 6px rgba(43,61,74,0.06);
  --shadow-lg: 0 16px 40px rgba(43,61,74,0.16), 0 4px 12px rgba(43,61,74,0.08);

  --gradient-energy: linear-gradient(135deg, var(--nexis-orange) 0%, var(--nexis-orange-2) 100%);
  --gradient-dark: linear-gradient(160deg, #24333F 0%, var(--nexis-charcoal) 60%, var(--nexis-blue) 140%);

  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --nav-h: 68px;
  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--nexis-white);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 .4em; color: var(--nexis-charcoal); line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 2.4vw, 2.3rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 1.8vw, 1.6rem); font-weight: 750; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0 0 .8em; color: var(--ink-soft); }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; padding: 28px 0 80px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: .92rem;
  border-radius: var(--radius-pill); border: none; cursor: pointer;
  padding: 12px 22px; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--gradient-energy); color: #201400; box-shadow: 0 6px 16px rgba(255,133,1,.32); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(255,133,1,.42); }
.btn-dark { background: var(--nexis-charcoal); color: var(--nexis-white); }
.btn-dark:hover { background: #223039; }
.btn-outline { background: transparent; color: var(--nexis-charcoal); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--nexis-charcoal); }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 10px 14px; }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { padding: 8px 16px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  border: 1px solid var(--border); padding: 22px; transition: box-shadow .18s ease, transform .18s ease;
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-flat { box-shadow: none; }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 40; height: var(--nav-h);
  background: var(--nexis-charcoal); color: var(--nexis-white);
  display: flex; align-items: center; box-shadow: 0 2px 12px rgba(0,0,0,.18);
}
.topnav-inner { width: 100%; max-width: 1900px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 22px; }
.topnav-logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; flex-shrink: 0; cursor: pointer; }
.topnav-logo small { display: block; font-family: var(--font-body); font-weight: 500; font-size: .62rem; letter-spacing: .11em; color: #C9D3DA; text-transform: uppercase; }
.topnav-links { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.topnav-right { min-width: fit-content; }
.topnav-link { padding: 9px 13px; border-radius: var(--radius-pill); font-size: .86rem; font-weight: 600; color: #C9D3DA; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; border: none; background: transparent; }
.topnav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.topnav-link.active { color: var(--nexis-charcoal); background: var(--nexis-orange); }
.topnav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topnav-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gradient-energy); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #201400; font-size: .82rem; cursor: pointer; border: 2px solid rgba(255,255,255,.25); }
.topnav-burger { display: none; background: transparent; border: none; color: #fff; padding: 8px; cursor: pointer; }

/* ---------- Progress bars ---------- */
.progress-track { width: 100%; height: 10px; border-radius: var(--radius-pill); background: var(--surface-sunk); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-pill); background: var(--gradient-energy); transition: width .5s cubic-bezier(.22,.9,.3,1); }
.progress-fill.blue { background: linear-gradient(135deg, var(--nexis-blue), var(--nexis-charcoal)); }
.progress-fill.locked { background: #CBD3D8; }
.progress-track.thin { height: 6px; }

/* ---------- Badges / pills / status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--radius-pill); font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.pill-orange { background: rgba(255,165,1,.14); color: #9A5B00; }
.pill-blue { background: rgba(68,90,125,.14); color: var(--nexis-blue); }
.pill-green { background: rgba(46,138,86,.14); color: #2E8A56; }
.pill-gray { background: var(--surface-sunk); color: var(--ink-faint); }
.pill-red { background: rgba(192,57,43,.12); color: #C0392B; }
.pill-dark { background: var(--nexis-charcoal); color: #fff; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.green { background: #2E8A56; }
.status-dot.orange { background: var(--nexis-orange); }
.status-dot.gray { background: #B7BEC4; }

/* ---------- Badge medallions ---------- */
.badge-medal { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: var(--shadow-sm); flex-shrink: 0; }
.badge-medal.locked { background: var(--surface-sunk); color: #B7BEC4; filter: grayscale(1); }
.badge-medal.solar { background: linear-gradient(150deg, var(--nexis-orange), var(--nexis-orange-2)); color: #241500; }
.badge-medal.hvac { background: linear-gradient(150deg, var(--nexis-blue), var(--nexis-charcoal)); color: #fff; }
.badge-medal.advisor { background: var(--nexis-charcoal); color: var(--nexis-orange); border: 2px solid var(--nexis-orange); box-shadow: 0 0 0 4px rgba(255,165,1,.16), var(--shadow-md); }
.badge-medal.specialist { background: #fff; border: 2px solid var(--border); color: var(--nexis-blue); }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-6 { gap: 6px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; } .gap-20 { gap: 20px; }
.muted { color: var(--ink-faint); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Section headers ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.section-head .eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--nexis-orange-2); margin-bottom: 4px; display: block; }

/* ---------- Hero band ---------- */
.hero-dark { background: var(--gradient-dark); color: var(--nexis-white); border-radius: var(--radius-lg); padding: 34px 30px; position: relative; overflow: hidden; }
.hero-dark::after { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,165,1,.28), transparent 70%); pointer-events: none; }
.hero-dark p { color: #CBD5DC; }

/* ---------- Stat tiles ---------- */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; }
.stat-tile .stat-value { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--nexis-charcoal); }
.stat-tile .stat-label { font-size: .74rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-top: 2px; }
.stat-tile .stat-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; background: rgba(255,165,1,.14); color: var(--nexis-orange-2); }

/* ---------- Certification path ---------- */
.cert-path { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; }
.cert-node { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 130px; text-align: center; }
.cert-node .node-circle { width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.cert-connector { font-size: 20px; color: var(--ink-faint); font-weight: 800; }

/* ---------- Lesson content blocks ---------- */
.lesson-body { max-width: 720px; }
.lesson-block { margin-bottom: 22px; }
.callout { border-radius: var(--radius-md); padding: 16px 18px; border-left: 4px solid var(--nexis-orange); background: rgba(255,165,1,.08); }
.callout.compliance { border-left-color: #C0392B; background: rgba(192,57,43,.06); }
.callout.tip { border-left-color: #2E8A56; background: rgba(46,138,86,.06); }
.callout.say-it { border-left-color: var(--nexis-blue); background: rgba(68,90,125,.07); font-style: italic; }
.callout h4 { margin-bottom: 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nexis-charcoal); }
.lesson-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.lesson-table th, .lesson-table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.lesson-table th { background: var(--surface-sunk); font-family: var(--font-display); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.lesson-list li { padding-left: 22px; position: relative; margin-bottom: 8px; color: var(--ink-soft); }
.lesson-list li::before { content: '●'; position: absolute; left: 0; color: var(--nexis-orange); font-size: .6rem; top: 6px; }
.diagram-frame { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 16px 12px; box-shadow: var(--shadow-sm); }
.diagram-frame svg { width: 100%; height: auto; display: block; }

/* ---------- Quiz ---------- */
.quiz-option { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-md); border: 1.5px solid var(--border); cursor: pointer; margin-bottom: 10px; transition: border-color .12s, background .12s; }
.quiz-option:hover { border-color: var(--nexis-blue); }
.quiz-option.selected { border-color: var(--nexis-blue); background: rgba(68,90,125,.06); }
.quiz-option.correct { border-color: #2E8A56; background: rgba(46,138,86,.08); }
.quiz-option.incorrect { border-color: #C0392B; background: rgba(192,57,43,.07); }
.quiz-letter { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-sunk); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .78rem; flex-shrink: 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-visual { min-height: 260px; } }
.login-visual { background: var(--gradient-dark); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 60px; position: relative; overflow: hidden; }
.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--nexis-white); }
.login-card { width: 100%; max-width: 380px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--nexis-charcoal); margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: .92rem; font-family: inherit; background: #fff; }
.field input:focus, .field select:focus { outline: none; border-color: var(--nexis-orange); box-shadow: 0 0 0 3px rgba(255,165,1,.15); }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); border: none; margin: 22px 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-circle { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.skel { background: linear-gradient(90deg, var(--surface-sunk) 25%, #ECEBE3 37%, var(--surface-sunk) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.certificate-frame { background: #fff; border: 10px solid var(--nexis-charcoal); border-radius: 4px; padding: 50px 40px; text-align: center; position: relative; max-width: 720px; margin: 0 auto; }
.certificate-frame::before { content: ''; position: absolute; inset: 10px; border: 1.5px solid var(--nexis-orange); pointer-events: none; }
.certificate-seal { width: 88px; height: 88px; border-radius: 50%; background: var(--gradient-energy); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; font-size: 36px; box-shadow: var(--shadow-md); }

@media print {
  .topnav, .no-print { display: none !important; }
  body { background: #fff; }
}

.mobile-menu { display: none; flex-direction: column; background: #223039; position: absolute; top: var(--nav-h); left: 0; right: 0; max-height: 0; overflow: hidden; transition: max-height .22s ease; box-shadow: var(--shadow-lg); z-index: 39; }
.mobile-menu.open { display: flex; max-height: 80vh; overflow-y: auto; }
.mobile-menu-link { display: block; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,.08); color: #D7E0E6; padding: 14px 20px; font-size: .95rem; font-weight: 600; cursor: pointer; }
.mobile-menu-link.active { color: var(--nexis-orange); }

.nav-dropdown-wrap { position: relative; flex-shrink: 0; }
.nav-dropdown-panel { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 190px; background: var(--nexis-charcoal); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50; flex-direction: column; }
.nav-dropdown-panel.open { display: flex; }
.nav-dropdown-item { display: block; width: 100%; text-align: left; background: transparent; border: none; color: #D7E0E6; padding: 12px 16px; font-size: .86rem; font-weight: 600; cursor: pointer; }
.nav-dropdown-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-dropdown-item.active { color: var(--nexis-orange); }

/* Switches to the hamburger menu well before the horizontal nav would
   need its own (invisible, undiscoverable) internal scrollbar to show
   every item. Measured: logo + full admin link set + XP/avatar needs
   ~1700px to lay out inline with no clipping, so the breakpoint sits
   well above that with margin for font/zoom differences across browsers. */
@media (max-width: 1800px) {
  .topnav-links { display: none; }
  .topnav-burger { display: flex; }
}
@media (max-width: 760px) {
  .login-visual { padding: 40px 26px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .container { padding: 0 14px; }
  .hero-dark { padding: 26px 20px; }
  h1 { font-size: 1.5rem; }
}
