/* ═══════════════════════════════════════════
   CoderFlow Enterprise Guardrails — Stylesheet
   ═══════════════════════════════════════════ */

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

:root {
  /* ─── CoderFlow Brand Colors ─── */
  --royal-blue: #4073F3;
  --cyan-accent: #00D4FF;
  --deep-navy: #0A0E27;
  --cloud-white: #F8FAFC;
  --slate-gray: #64748B;

  /* ─── Semantic aliases ─── */
  --navy: #0A0E27;
  --navy-dark: #0A0E27;
  --navy-light: #131836;
  --accent: #00D4FF;
  --blue: #4073F3;
  --blue-light: #EBF0FE;
  --green: #4CAF50;
  --green-light: #E8F5E9;
  --orange: #FF9800;
  --orange-light: #FFF3E0;
  --purple: #9C27B0;
  --purple-light: #F3E5F5;
  --teal: #009688;
  --red: #F44336;
  --red-light: #FFEBEE;
  --indigo: #3F51B5;
  --indigo-light: #E8EAF6;

  --text: #000000;
  --text-light: #64748B;
  --text-muted: #64748B;
  --bg: #ffffff;
  --bg-alt: #F8FAFC;
  --bg-code: #0A0E27;
  --border: #e0e0e0;
  --border-light: #f0f0f0;

  --sidebar-width: 280px;
  --content-max: 800px;
  --font: 'Inter', system-ui, -apple-system, 'SF Pro Display', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  font-family: var(--font);
  color: var(--text);
  line-height: 1.7;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─── */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy-dark);
  color: #ccc;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.sidebar-logo span {
  color: var(--royal-blue);
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.nav-item {
  display: flex;
  align-items: baseline;
  padding: 9px 24px;
  text-decoration: none;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  line-height: 1.4;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.nav-item.active {
  color: #fff;
  background: rgba(64, 115, 243, 0.12);
  border-left-color: var(--royal-blue);
}

.nav-number {
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan-accent);
  min-width: 28px;
  opacity: 0.7;
}

.nav-item.active .nav-number {
  opacity: 1;
}

/* Sidebar footer / progress */
.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.progress-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--royal-blue), var(--cyan-accent));
  border-radius: 2px;
  width: 0%;
  transition: width 0.25s ease;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: none;
  background: var(--navy-dark);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  align-items: center;
  justify-content: center;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

/* ─── Hero ─── */
.hero {
  background: linear-gradient(135deg, var(--deep-navy) 0%, #0d1440 60%, #111b4a 100%);
  color: #fff;
  padding: 80px 40px 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0,212,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--royal-blue), var(--cyan-accent));
}

.hero-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  position: relative;
}

.hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  border: 1px solid rgba(0,212,255,0.4);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 8px;
}

.hero h1 span {
  color: var(--cyan-accent);
}

.hero-subtitle {
  font-size: 18px;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
  margin-bottom: 20px;
}

.hero-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-pill {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.4);
  color: var(--cyan-accent);
}

/* ─── Sections ─── */
.content-body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 40px;
}

.section {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border-light);
}

.section:last-child {
  border-bottom: none;
}

.section-alt {
  background: var(--bg-alt);
  margin: 0 -40px;
  padding-left: 40px;
  padding-right: 40px;
}

.section-number {
  font-size: 13px;
  font-weight: 700;
  color: var(--royal-blue);
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.section h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.section-divider {
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--royal-blue), var(--cyan-accent));
  border-radius: 2px;
  margin: 12px 0 24px;
}

.section h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}

.section h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
}

.section p {
  margin-bottom: 16px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
}

.section ul,
.section ol {
  margin: 0 0 16px 24px;
  font-size: 15px;
  line-height: 1.75;
}

.section li {
  margin-bottom: 8px;
  color: var(--text);
}

.section li strong {
  color: var(--text);
}

/* ─── Callout Boxes ─── */
.callout {
  border-radius: 8px;
  padding: 18px 22px;
  margin: 24px 0;
  font-size: 14.5px;
  line-height: 1.7;
}

.callout-blue {
  background: var(--blue-light);
  border-left: 4px solid var(--royal-blue);
  color: var(--text);
}

.callout-red {
  background: var(--red-light);
  border-left: 4px solid var(--red);
  color: #b71c1c;
}

.callout-green {
  background: var(--green-light);
  border-left: 4px solid var(--green);
  color: var(--text);
}

.callout-label {
  font-weight: 700;
  display: inline;
}

/* ─── Tables ─── */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 500px;
}

.table-wrapper thead th {
  background: var(--royal-blue);
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  white-space: nowrap;
}

.table-wrapper tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.table-wrapper tbody tr:nth-child(even) {
  background: var(--bg-alt);
}

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

.table-wrapper code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-code);
  color: #e0e0e0;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ─── Guardrail Layer Cards ─── */
.guardrail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0;
}

.guardrail-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 20px;
  transition: border-color 0.2s ease;
}

.guardrail-card:hover {
  border-color: var(--royal-blue);
}

.guardrail-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--royal-blue);
  margin: 0 0 8px;
}

.guardrail-card p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
  margin: 0;
}

/* ─── Workflow Diagram ─── */
.workflow-diagram {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  margin: 28px 0;
}

.workflow-title {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.workflow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: nowrap;
}

.wf-step {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 2px solid;
  border-radius: 10px;
  padding: 14px 10px;
  width: 110px;
  min-height: 66px;
  background: #fff;
  text-align: center;
}

.wf-step span {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.wf-step-submit { border-color: var(--royal-blue); color: var(--royal-blue); }
.wf-step-container { border-color: var(--deep-navy); color: var(--deep-navy); }
.wf-step-agent { border-color: var(--deep-navy); color: var(--deep-navy); }
.wf-step-review { border-color: var(--cyan-accent); color: #0891b2; }
.wf-step-approve { border-color: var(--royal-blue); color: var(--royal-blue); }

.wf-arrow {
  display: flex;
  align-items: center;
  padding: 0 4px;
  font-size: 20px;
  color: var(--text-muted);
}

.workflow-note {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--royal-blue);
}

/* ─── CTA Section ─── */
.cta-section {
  text-align: center;
}

.cta-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.cta-btn-primary {
  background: var(--royal-blue);
  color: #fff;
}

.cta-btn-primary:hover {
  background: #3060d4;
}

/* ─── Footer ─── */
.page-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 32px 24px;
  font-size: 13px;
}

.page-footer a {
  color: var(--cyan-accent);
  text-decoration: none;
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-header {
    padding-top: 56px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .hero {
    padding: 60px 24px 44px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .content-body {
    padding: 0 24px;
  }

  .section-alt {
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .guardrail-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .hero {
    padding: 50px 18px 36px;
  }

  .hero h1 {
    font-size: 26px;
  }

  .hero-subtitle {
    font-size: 15px;
  }

  .hero-pills {
    gap: 6px;
  }

  .hero-pill {
    font-size: 11px;
    padding: 4px 10px;
  }

  .content-body {
    padding: 0 18px;
  }

  .section-alt {
    margin: 0 -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .section {
    padding: 36px 0 32px;
  }

  .section h2 {
    font-size: 22px;
  }

  .section h3 {
    font-size: 17px;
  }

  .workflow-steps {
    flex-direction: column;
    gap: 0;
  }

  .wf-step {
    width: 80%;
    max-width: 220px;
  }

  .wf-arrow {
    transform: rotate(90deg);
    padding: 4px 0;
  }

  .table-wrapper {
    margin: 16px -8px;
    border-radius: 6px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .sidebar,
  .progress-fill {
    transition: none;
  }
}
