/* ============================================================================
   Ledgr Docs — shared stylesheet
   Linked from every /docs/<page>.html for consistent theming.
============================================================================ */

:root {
  --bg: #0B1120;
  --bg-card: #111827;
  --bg-card-hover: #162032;
  --bg-code: #0d1828;
  --border: #1E293B;
  --border-hover: #334155;
  --text: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent: #0D9488;
  --accent-hover: #059669;
  --accent-glow: rgba(13, 148, 136, 0.15);
  --accent-soft: rgba(13, 148, 136, 0.08);
  --green: #22C55E;
  --amber: #F59E0B;
  --red: #EF4444;
  --radius: 10px;
  --radius-lg: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; overflow-x: hidden; max-width: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.65;
  overflow-x: hidden; max-width: 100%; width: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---- Layout ---- */
.docs-layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; max-width: 100%; overflow-x: hidden; }
@media (max-width: 900px) { .docs-layout { grid-template-columns: 1fr; } }

/* ---- Sidebar ---- */
.docs-sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  min-width: 0; max-width: 100%; overflow-x: hidden;
}
@media (max-width: 900px) {
  .docs-sidebar {
    position: static; height: auto;
    padding: 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-width: 100%;
  }
}
.docs-brand { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; margin-bottom: 1rem; }
.docs-brand img { height: 24px; }
.docs-brand-text { font-weight: 700; font-size: 1rem; color: var(--text); }
.docs-sidebar h4 {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); padding: 0.75rem 0.5rem 0.4rem; font-weight: 600;
}
.docs-nav { list-style: none; }
.docs-nav li a {
  display: block; padding: 0.5rem 0.75rem; border-radius: 6px;
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  transition: all 0.15s; text-decoration: none;
}
.docs-nav li a:hover { background: var(--bg-card-hover); color: var(--text); text-decoration: none; }
.docs-nav li a.active { background: var(--accent-soft); color: var(--accent); }

/* ---- Main content ---- */
.docs-main { padding: 2.5rem 3rem; max-width: 900px; min-width: 0; overflow-x: hidden; }
@media (max-width: 900px) { .docs-main { padding: 1.5rem; } }
@media (max-width: 768px) { .docs-main { padding: 1.25rem 1rem; } }
@media (max-width: 400px) { .docs-main { padding: 1rem 0.75rem; } }

.docs-breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.docs-main h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 0.75rem; line-height: 1.2; overflow-wrap: break-word; }
.docs-main h2 {
  font-size: 1.5rem; font-weight: 700; margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
  overflow-wrap: break-word;
}
.docs-main h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text); overflow-wrap: break-word; }
.docs-main h4 { font-size: 1rem; font-weight: 600; margin: 1rem 0 0.4rem; color: var(--text-secondary); overflow-wrap: break-word; }

/* ---- Mobile typography ---- */
@media (max-width: 768px) {
  .docs-main h1 { font-size: 1.6rem; }
  .docs-main h2 { font-size: 1.25rem; }
  .docs-main h3 { font-size: 1.05rem; }
  .docs-main p { font-size: 0.9rem; }
  .docs-main ul, .docs-main ol { font-size: 0.9rem; margin-left: 1.2rem; }
}
@media (max-width: 400px) {
  .docs-main h1 { font-size: 1.4rem; }
  .docs-main h2 { font-size: 1.1rem; }
}
.docs-main p { margin-bottom: 1rem; color: var(--text-secondary); font-size: 0.95rem; overflow-wrap: break-word; }
.docs-main p strong { color: var(--text); }

.docs-main ul, .docs-main ol { margin: 0.5rem 0 1rem 1.5rem; color: var(--text-secondary); font-size: 0.95rem; }
.docs-main li { margin-bottom: 0.4rem; line-height: 1.6; overflow-wrap: break-word; }
.docs-main li strong { color: var(--text); }

.docs-main code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem; border-radius: 4px;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.85em; color: var(--accent);
  word-break: break-all;
}
.docs-main pre {
  background: var(--bg-code); border: 1px solid var(--border);
  padding: 1rem; border-radius: var(--radius);
  overflow-x: auto; margin: 1rem 0; font-size: 0.85rem;
  font-family: 'SF Mono', Consolas, monospace; line-height: 1.5;
  max-width: 100%;
}
.docs-main pre code { background: none; border: 0; padding: 0; color: var(--text); word-break: normal; }

.docs-main hr { border: 0; height: 1px; background: var(--border); margin: 2.5rem 0; }

/* Callout boxes */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.85rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.25rem 0; font-size: 0.9rem; color: var(--text);
}
.callout strong { color: var(--accent); }
.callout-warning { border-left-color: var(--amber); background: rgba(245, 158, 11, 0.08); }
.callout-warning strong { color: var(--amber); }
.callout-tip { border-left-color: var(--green); background: rgba(34, 197, 94, 0.08); }
.callout-tip strong { color: var(--green); }

/* Step list (numbered with big circles) */
.steps { counter-reset: step; list-style: none; margin-left: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem;
}
.steps > li > strong { display: block; color: var(--text); margin-bottom: 0.25rem; font-size: 1rem; }

/* Cards grid (for hub page) */
.docs-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; margin: 1.5rem 0; }
.docs-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.8), rgba(15, 23, 42, 0.5));
  border: 1px solid rgba(30, 41, 59, 0.6);
  border-radius: var(--radius-lg); padding: 1.5rem;
  transition: all 0.3s; text-decoration: none; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.docs-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(13, 148, 136, 0.3), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.docs-card:hover::before { opacity: 1; }
.docs-card:hover {
  border-color: rgba(13, 148, 136, 0.4); transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow); text-decoration: none;
}
.docs-card .card-emoji { font-size: 2.25rem; line-height: 1; margin-bottom: 0.75rem; }
.docs-card h3 { color: var(--text); margin-bottom: 0.5rem; font-size: 1.1rem; font-weight: 700; }
.docs-card p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; line-height: 1.6; }

/* Tables — wrapped in scrollable container via CSS, no layout breakage */
.docs-main table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); margin: 1rem 0;
  display: table; max-width: 100%;
}
.docs-main th, .docs-main td {
  padding: 0.7rem 0.9rem; text-align: left;
  border-bottom: 1px solid var(--border); font-size: 0.875rem;
  overflow-wrap: break-word;
}
.docs-main thead th { background: var(--bg-card-hover); font-weight: 600; color: var(--text-secondary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
.docs-main tbody tr:last-child td { border-bottom: 0; }

/* Mobile tables: wrap in scrollable area */
@media (max-width: 768px) {
  .docs-main table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .docs-main thead, .docs-main tbody { display: table; width: 100%; min-width: 400px; }
  .docs-main th, .docs-main td { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
}

/* Bottom CTA card */
.docs-cta {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(13, 148, 136, 0.12) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem; margin: 3rem 0 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.docs-cta-text h4 { font-size: 1.1rem; margin-bottom: 0.25rem; color: var(--text); }
.docs-cta-text p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }
.docs-cta-btn {
  background: #25D366; color: white !important; padding: 0.65rem 1.2rem;
  border-radius: 8px; font-weight: 600; text-decoration: none; font-size: 0.9rem;
  display: inline-flex; align-items: center; gap: 0.5rem;
}
.docs-cta-btn:hover { background: #1da851; text-decoration: none; }

/* ---- Mobile CTA + WhatsApp FAB ---- */
@media (max-width: 768px) {
  .docs-cta { padding: 1.25rem; gap: 0.75rem; flex-direction: column; text-align: center; }
  .docs-cta-btn { width: 100%; justify-content: center; }
  .whatsapp-fab { width: 48px; height: 48px; bottom: 1rem; right: 1rem; }
  .whatsapp-fab svg { width: 24px; height: 24px; }
}

/* WhatsApp FAB (same as landing) */
.whatsapp-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200;
  width: 56px; height: 56px; border-radius: 50%; background: #25D366;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  transition: transform 0.2s;
}
.whatsapp-fab:hover { transform: scale(1.08); }
.whatsapp-fab svg { width: 28px; height: 28px; fill: white; }
