/* ================================================================
   components.css — Shared Component Styles (Corwyn App Shell)
   ================================================================ */

/* ── APP HEADER ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0,0,0,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.app-header.course-mode .header-inner {
  max-width: none;
}
[data-theme="light"] .app-header {
  background: rgba(255,255,255,0.94);
}

/* ── MAIN CONTENT AREA ── */
#app-content {
  min-height: calc(100vh - 62px);
}

/* ── DOCUMENTS SUB-NAV ── */
.doc-sub-nav {
  display: flex;
  gap: 4px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 32px 0;
  flex-wrap: wrap;
}
.doc-sub-tab {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}
.doc-sub-tab:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}
.doc-sub-tab.active {
  background: var(--surface2);
  color: var(--accent-bright);
  border-color: var(--accent);
}

/* ── BRAND ── */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  transition: background 0.3s;
}

.brand-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* ── NAV TABS ── */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}

.nav-tab.active {
  background: var(--surface2);
  color: var(--accent-bright);
  border-color: var(--accent);
}

/* Gold-accented nav tab (used for Achievements) */
.nav-tab.nav-tab-gold {
  color: #e5b53f;
}
.nav-tab.nav-tab-gold:hover {
  color: #f0cc69;
  background: rgba(229,181,63,0.10);
  border-color: rgba(229,181,63,0.45);
}
.nav-tab.nav-tab-gold.active {
  color: #f0cc69;
  background: rgba(229,181,63,0.12);
  border-color: rgba(229,181,63,0.65);
  box-shadow: 0 0 0 1px rgba(229,181,63,0.20);
}

/* ── THEME TOGGLE (button style) ── */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--toggle-bg);
  color: var(--toggle-fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.25s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* ── HERO SECTION ── */
.hero {
  background: var(--hero-grad);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 32px 52px;
}

.hero-tag,
.hero-badge {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.hero-tag {
  background: rgba(194,198,212,0.08);
  border: 1px solid rgba(194,198,212,0.25);
  color: var(--accent);
  letter-spacing: 1.5px;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 50px);
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted);
  font-size: 17px;
  max-width: 580px;
  line-height: 1.75;
}

.hero-stats {
  display: flex;
  gap: 20px;
  margin-top: 44px;
  flex-wrap: wrap;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 30px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 34px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ── CONTENT WRAPPER ── */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 32px 80px;
}

/* ── SECTIONS ── */
.section {
  margin-bottom: 52px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.section-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(194,198,212,0.1);
  border: 1px solid rgba(194,198,212,0.25);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
}

.section-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--accent);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-body {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.card-silver {
  border-left: 3px solid var(--accent);
}

.card-green {
  border-left: 3px solid var(--accent2);
}

.card-red {
  border-left: 3px solid var(--accent3);
}

.card-gold {
  border-left: 3px solid #e5b53f;
}

/* ── GRIDS ── */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ── TABLES ── */
.role-table {
  width: 100%;
  border-collapse: collapse;
}

.role-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.role-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

.role-table tr:last-child td {
  border-bottom: none;
}

.role-table tr:hover td {
  background: var(--surface2);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.summary-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.summary-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.summary-table tr:last-child td {
  border-bottom: none;
}

.summary-table tr:hover td {
  background: var(--surface2);
}

/* ── BADGES / TAGS ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-l1 {
  background: rgba(194,198,212,0.12);
  color: var(--accent);
}

.badge-l2 {
  background: rgba(232,234,242,0.12);
  color: var(--accent-bright);
  border: 1px solid rgba(232,234,242,0.2);
}

.badge-platform {
  background: rgba(255,193,7,0.12);
  color: #ffc107;
}

.badge-eval {
  background: rgba(156,39,176,0.15);
  color: #ce93d8;
}

.badge-lead {
  background: rgba(0,212,170,0.12);
  color: var(--accent2);
}

.tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-block;
}

.tag-silver {
  background: rgba(194,198,212,0.1);
  color: var(--accent);
  border: 1px solid rgba(194,198,212,0.2);
}

.tag-red {
  background: rgba(255,107,107,0.1);
  color: var(--accent3);
}

.tag-purple {
  background: var(--tag-bg);
  color: var(--tag-text);
}

.tag-blue,
.tag-green {
  background: var(--tag-bg2);
  color: var(--tag-text2);
}

.tag-green {
  background: var(--tag-bg3);
  color: var(--tag-text3);
}

/* ── STATUS PILLS ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.status-done {
  background: rgba(0,212,170,0.12);
  color: var(--accent2);
}

.status-active {
  background: rgba(108,99,255,0.15);
  color: var(--accent-bright);
}

.status-planned {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

.status-risk {
  background: rgba(255,107,107,0.12);
  color: var(--accent3);
}

.status-rr {
  background: rgba(164,196,0,0.12);
  color: #a4c400;
  border: 1px solid rgba(164,196,0,0.25);
}

/* ── INFO NOTE ── */
.info-note {
  background: rgba(108,99,255,0.07);
  border: 1px solid rgba(108,99,255,0.25);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--accent-bright);
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}

/* ── FOOTER ── */
.footer,
footer {
  border-top: 1px solid var(--border);
  transition: border-color 0.3s;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-text {
  font-size: 13px;
  color: var(--muted);
}

/* ── BACK LINK ── */
.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

/* ── UTILITY COLORS ── */
.silver { color: var(--accent-bright); }
.green  { color: var(--accent2); }
.red    { color: var(--accent3); }

.fill-silver { background: linear-gradient(90deg, #c2c6d4, #ffffff); }
.fill-green  { background: var(--accent2); }
.fill-red    { background: var(--accent3); }

/* ── CODE BLOCKS ── */
.cw {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  overflow: hidden;
  margin: 18px 0;
}
.ch {
  background: var(--code-header);
  padding: 9px 16px;
  display: flex;
  align-items: center;
}
.cl {
  color: var(--code-label);
  font-size: 11px;
  font-family: 'Fira Code', Consolas, monospace;
}
.cb {
  margin-left: auto;
  background: var(--code-btn);
  color: var(--code-text);
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.cb:hover { background: var(--code-btn-hover); }
.cb.copied { background: var(--accent2); color: #fff; }
.cw pre {
  margin: 0;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--code-text);
  font-family: 'Fira Code', Consolas, monospace;
  white-space: pre;
  background: transparent;
}

/* ── MARKDOWN TABLE ── */
.md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.md-table th {
  background: var(--tag-bg);
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.md-table td {
  padding: 7px 12px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.md-table tr:nth-child(even) td {
  background: var(--surface2);
}

/* ── PRIORITY LABELS ── */
.pri-high { color: var(--accent3); font-size: 11px; font-weight: 700; }
.pri-med  { color: #ffc107;        font-size: 11px; font-weight: 700; }
.pri-low  { color: var(--muted);   font-size: 11px; font-weight: 700; }

/* ── MOBILE NAV HAMBURGER BUTTON ── */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
  transform-origin: center;
}

.mobile-nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.mobile-nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE NAV OVERLAY ── */
.mobile-nav-overlay {
  /* Always in layout — opacity+pointer-events handle show/hide so transitions work on iOS */
  position: fixed;
  inset: 0;
  z-index: 149;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.mobile-nav-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── MOBILE NAV DRAWER ── */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  z-index: 150;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.mobile-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-nav-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.mobile-nav-close:hover {
  color: var(--text);
  border-color: var(--accent);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 12px 0 40px;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.18s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}

.mobile-nav-links a:hover {
  color: var(--text);
  background: var(--surface2);
}

.mobile-nav-links a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-weight: 600;
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .mobile-nav-toggle {
    display: flex;
  }

  .nav-tabs {
    display: none;
  }

  .header-inner {
    padding: 0 16px;
    height: 56px;
  }

  .brand-sep,
  .brand-label {
    display: none;
  }

  #app-content {
    min-height: calc(100vh - 56px);
  }
}

@media (max-width: 640px) {
  .hero-inner {
    padding: 40px 16px 36px;
  }

  .hero-stats {
    gap: 12px;
  }

  .stat-num {
    font-size: 22px;
  }

  .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    padding: 20px 16px;
    flex-direction: column;
    gap: 8px;
  }

  /* Scrollable tables on mobile */
  .summary-table,
  .role-table,
  .md-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }

  .summary-table th,
  .summary-table td,
  .role-table th,
  .role-table td {
    padding: 10px 12px;
  }
}

/* ── SCROLLABLE TABLE WRAPPER ── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 12px 0;
}

.table-scroll > table {
  border: none;
  border-radius: 0;
  margin: 0;
  min-width: 480px;
}

/* ── VIDEO EMBED ── */
.video-embed {
  margin: 24px 0 32px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.video-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}
.video-embed-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  aspect-ratio: 16 / 9;
  background: var(--hero-grad);
}
.video-embed-placeholder svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.7;
}
.video-embed-placeholder p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.video-embed-placeholder .video-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
