/* ═══════════════════════════════════════════════════════════
   Akrion One — Developer Portal Stylesheet
   Extends base marketing styles with developer-specific layouts
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --primary:       #54c7ff;
  --primary-hover: #3ab8f5;
  --secondary:     #8b7bff;
  --accent:        #22d3a7;
  --warn:          #fbbf24;
  --bg-base:       #070b14;
  --bg-mid:        #0d1424;
  --bg-accent:     #151f38;
  --surface:       rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --card-border:   rgba(255, 255, 255, 0.10);
  --text-main:     #e8edf5;
  --text-dim:      #8c99b3;
  --text-muted:    #5a6a82;
  --font-display:  'Space Grotesk', system-ui, sans-serif;
  --font-body:     'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', ui-monospace, monospace;
  --radius:        14px;
  --max-width:     1100px;
  --sidebar-width: 260px;
}

html { scroll-behavior: smooth; }

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

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  color: #f3f7ff;
}

h1 { font-size: 2rem; line-height: 1.15; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; line-height: 1.2; margin-top: 2.5rem; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--card-border); }
h3 { font-size: 1.15rem; margin-top: 2rem; margin-bottom: 0.5rem; }
h4 { font-size: 1rem; margin-top: 1.5rem; margin-bottom: 0.4rem; color: var(--primary); }

p, li { color: var(--text-dim); font-size: 0.95rem; }
p { margin-bottom: 0.75rem; }
ul, ol { margin: 0.5rem 0 1rem 1.5rem; }
li { margin-bottom: 0.35rem; }

strong { color: var(--text-main); }

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

/* ── Sidebar ──────────────────────────────────────────────── */
.dev-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-mid);
  border-right: 1px solid var(--card-border);
  padding: 1.5rem 0;
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 1rem;
}
.sidebar-logo img { height: 28px; }
.sidebar-logo span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #f3f7ff;
}
.sidebar-logo .badge-dev {
  font-size: 0.6rem;
  font-weight: 600;
  background: rgba(139, 123, 255, 0.15);
  color: var(--secondary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(139, 123, 255, 0.25);
}

.sidebar-section {
  padding: 0.5rem 1.25rem;
}
.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li { margin-bottom: 0.15rem; }
.sidebar-nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  border-radius: 6px;
  transition: all 0.15s;
}
.sidebar-nav a:hover {
  background: var(--surface-hover);
  color: var(--primary);
}
.sidebar-nav a.active {
  background: rgba(84, 199, 255, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-back {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.sidebar-back:hover { color: var(--primary); }

/* ── Main Content ─────────────────────────────────────────── */
.dev-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 2.5rem 3rem 4rem;
  max-width: calc(var(--max-width) + var(--sidebar-width));
}

.dev-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--card-border);
}

.dev-header .breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.dev-header .breadcrumb a { color: var(--text-dim); }

/* ── Code Blocks ──────────────────────────────────────────── */
pre {
  background: var(--bg-mid);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  position: relative;
}
pre code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-main);
  background: none;
  padding: 0;
  border: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(84, 199, 255, 0.1);
  color: var(--primary);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  border: 1px solid rgba(84, 199, 255, 0.15);
}

.code-label {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ── Callout Boxes ────────────────────────────────────────── */
.callout {
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  border-left: 3px solid;
}
.callout p { margin: 0; font-size: 0.9rem; }
.callout-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.callout.info {
  background: rgba(84, 199, 255, 0.06);
  border-color: var(--primary);
}
.callout.info .callout-title { color: var(--primary); }

.callout.warning {
  background: rgba(251, 191, 36, 0.06);
  border-color: var(--warn);
}
.callout.warning .callout-title { color: var(--warn); }

.callout.success {
  background: rgba(34, 211, 167, 0.06);
  border-color: var(--accent);
}
.callout.success .callout-title { color: var(--accent); }

/* ── Tables ───────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
}
th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: rgba(84, 199, 255, 0.08);
  color: var(--primary);
  font-weight: 600;
  border-bottom: 1px solid var(--card-border);
}
td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ── Cards for developer guides ───────────────────────────── */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.guide-card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, border-color 0.2s;
}
.guide-card:hover {
  transform: translateY(-2px);
  border-color: rgba(84, 199, 255, 0.2);
}
.guide-card h4 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}
.guide-card p { font-size: 0.85rem; margin: 0; }

.guide-card .guide-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ── Step indicators ──────────────────────────────────────── */
.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(84, 199, 255, 0.12);
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.step-content h4 { margin-top: 0; }

/* ── API Reference ────────────────────────────────────────── */
.endpoint {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}
.endpoint-method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-right: 0.5rem;
}
.endpoint-method.get  { background: rgba(34, 211, 167, 0.15); color: var(--accent); }
.endpoint-method.post { background: rgba(84, 199, 255, 0.15); color: var(--primary); }
.endpoint-method.put  { background: rgba(251, 191, 36, 0.15); color: var(--warn); }

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-main);
}

/* ── Mobile sidebar toggle ────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg-base);
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(84, 199, 255, 0.3);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  /* Defensively prevent any wide child (long code line, table, etc.) from
     forcing the whole page to scroll horizontally on mobile. */
  html, body { overflow-x: hidden; }

  .dev-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .dev-sidebar.open {
    transform: translateX(0);
  }
  .dev-main {
    margin-left: 0;
    padding: 2rem 1.25rem 5rem;  /* extra bottom for FAB clearance */
    max-width: 100%;
    width: 100%;
    /* min-width: 0 lets flex/grid children shrink instead of overflow. */
    min-width: 0;
  }
  /* Headlines: allow long words/identifiers to break instead of overflow. */
  .dev-main h1, .dev-main h2, .dev-main h3 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .dev-main h1 { font-size: 1.85rem; line-height: 1.15; }
  .dev-main h2 { font-size: 1.35rem; }
  /* Code blocks: keep them inside the viewport — internal horizontal scroll
     only, never page-level. */
  pre {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  pre code {
    /* preserve formatting, no wrapping inside <pre>; horizontal scroll handles it */
    white-space: pre;
  }
  /* Inline tables: scroll the table itself, not the page. */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .guide-grid { grid-template-columns: 1fr; }
}
