/* ═══════════════════════════════════════════════
   Funderial SDK — Shared Demo Styles
   ═══════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --bg: #f1f5f9;
  --card-bg: #fff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --nav-h: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Navigation ── */
.nav-bar {
  background: #0f172a;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #1e293b;
}
.nav-bar .logo {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.nav-bar .logo svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav-links a:hover { color: #e2e8f0; background: rgba(255,255,255,0.04); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,0.06); border-bottom-color: currentColor; }

/* ── Container ── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ── Hero ── */
.hero {
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.hero h1 {
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hero p {
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  margin-top: 4px;
}
.hero .badge {
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 5px 16px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.25);
  white-space: nowrap;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.card-header h2,
.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header .accent-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.card-header .tag {
  font-size: 10px;
  background: #f1f5f9;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Form Fields ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.field-row .full { grid-column: 1 / -1; }
.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field-group label .req { color: var(--danger); }
.field-group input,
.field-group select {
  padding: 10px 12px;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #f8fafc;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}

/* ── Info / Alert Bars ── */
.info-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: #f8fafc;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.info-bar strong { color: var(--text); }
.info-bar .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.info-bar .status-dot.active { background: var(--success); }

.alert-note {
  background: #fef9c3;
  border-left: 3px solid var(--warning);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-note code {
  background: #fef3c7;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.alert-info {
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #4338ca;
  margin-bottom: 18px;
  line-height: 1.5;
}
.alert-info code {
  background: #c7d2fe;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #166534;
  margin-bottom: 18px;
  line-height: 1.5;
}
.alert-success strong {
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  white-space: nowrap;
  min-height: 38px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(37,99,235,0.2); }
.btn-secondary { background: #0f172a; color: #fff; }
.btn-secondary:hover { background: #1e293b; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; color: var(--text); }

/* ── Quick Nav / Footer Section ── */
.footer-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
}
.footer-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}
.quick-nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.page-footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
}
.page-footer a { color: var(--accent); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

/* ── Demo Links Grid ── */
.demo-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.demo-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: all .15s ease;
}
.demo-links a:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

/* ── Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.data-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.wrap-table { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ── Key-Value Grid ── */
.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.kv-item {
  display: flex;
  padding: 7px 0;
  border-bottom: 1px solid #f8fafc;
  font-size: 13px;
}
.kv-item:last-child { border-bottom: none; }
.kv-item .k {
  flex: 0 0 140px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}
.kv-item .v {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

/* ── Definition List Grid ── */
.dl-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  font-size: 13px;
}
.dl-grid dt { font-weight: 600; color: var(--text-muted); }
.dl-grid dd { margin: 0; color: var(--text); }

/* ── Stat Cards ── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-lg); }
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-card .lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Scenario Bar (Customer) ── */
.scenario-bar {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.scenario-bar::-webkit-scrollbar { display: none; }
.scenario-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  font-family: inherit;
}
.scenario-btn:hover {
  border-color: #94a3b8;
  color: var(--text);
  background: #f1f5f9;
}
.scenario-btn.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

/* ── Session Bar (Draft Resume) ── */
.session-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.session-btn {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  min-height: 44px;
}
.session-btn:hover { transform: translateY(-1px); }
.session-btn.seed { background: #0f766e; color: #fff; }
.session-btn.seed:hover { background: #115e59; }
.session-btn.clear { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border); }
.session-btn.clear:hover { background: #e2e8f0; }
.session-btn.expire { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.session-btn.expire:hover { background: #fee2e2; }
.session-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
  margin-bottom: 16px;
}
.session-status.has-draft { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }
.session-status.no-draft { background: #f8fafc; color: var(--text-muted); border: 1px solid var(--border); }
.session-status.expired-draft { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* ── Payload / Console Display ── */
.payload {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 11px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  word-break: break-all;
  overflow-x: auto;
}

/* ── Security Attack Items ── */
.attack-grid { display: flex; flex-direction: column; gap: 12px; }
.attack-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  border-left: 3px solid #94a3b8;
  transition: transform .1s ease;
}
.attack-item:hover { transform: translateX(2px); }
.attack-item.critical { border-left-color: var(--danger); }
.attack-item.high { border-left-color: #ea580c; }
.attack-item.medium { border-left-color: #a16207; }
.attack-item h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.attack-item .sev {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.attack-item.critical .sev { background: #fef2f2; color: var(--danger); }
.attack-item.high .sev { background: #fff7ed; color: #ea580c; }
.attack-item.medium .sev { background: #fef9c3; color: #a16207; }

/* ── Document / Test Item Grid ── */
.docs-grid { display: flex; flex-direction: column; gap: 10px; }
.doc-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  border-left: 3px solid #94a3b8;
  transition: transform .1s ease;
}
.doc-item:hover { transform: translateX(2px); }
.doc-item.upload { border-left-color: #2563eb; }
.doc-item.reject { border-left-color: var(--danger); }
.doc-item.edge { border-left-color: var(--warning); }

/* ── Theme Controls ── */
.theme-panel { max-width: 500px; margin: 0 auto; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-field { display: flex; flex-direction: column; gap: 3px; }
.theme-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.theme-field input,
.theme-field select {
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: inherit;
  background: #f8fafc;
  transition: all .15s ease;
}
.theme-field input:focus,
.theme-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
  background: #fff;
}
.theme-field input[type="color"] { height: 44px; cursor: pointer; padding: 2px; }
.btn-apply {
  grid-column: 1 / -1;
  padding: 10px;
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all .15s ease;
  font-family: inherit;
}
.btn-apply:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-reset {
  grid-column: 1 / -1;
  padding: 8px;
  margin-top: 4px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  min-height: 44px;
  transition: all .15s ease;
  font-family: inherit;
}
.btn-reset:hover { background: #f3f4f6; }

/* ── Loading / Dynamic Zones ── */
.load-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s ease;
}
.load-zone.loaded { border-color: #22c55e; background: #f0fdf4; color: #166534; }
.load-zone.loaded2 { border-color: #eab308; background: #fefce8; color: #92400e; }

/* ── Checklists ── */
.checklist {
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 12px;
  color: #4338ca;
  line-height: 1.7;
  margin-bottom: 20px;
}
.checklist .pass { color: var(--success); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-bar { padding: 0 16px; }
  .nav-links a { padding: 0 10px; font-size: 11px; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .theme-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .container { padding: 20px 12px; }
  .demo-links a { width: 100%; justify-content: center; }
  .stat-row { grid-template-columns: 1fr; }
  .session-bar { flex-direction: column; }
  .session-btn { width: 100%; }
}
