/* SwiftChat Documentation - Styles */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #0f0f13;
  --bg-card: #1a1a24;
  --bg-card-hover: #22223a;
  --bg-code: #13131d;
  --text: #e4e4ed;
  --text-muted: #9494a8;
  --border: #2a2a3d;
  --accent: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gradient-primary: linear-gradient(135deg, #6366f1, #818cf8, #22d3ee);
  --radius: 12px;
  --sidebar-width: 280px;
  --header-height: 64px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }

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

/* ===== HEADER ===== */
.doc-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: rgba(15,15,19,.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.doc-header .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.doc-header .logo svg { width: 28px; height: 28px; }
.doc-header nav { display: flex; gap: 6px; }
.doc-header nav a {
  padding: 6px 14px; border-radius: 8px; color: var(--text-muted);
  text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: all .2s;
}
.doc-header nav a:hover, .doc-header nav a.active { color: var(--text); background: var(--bg-card); }
.doc-header .version-badge {
  background: var(--gradient-primary); color: #fff; padding: 4px 12px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; }

/* ===== SIDEBAR ===== */
.doc-sidebar {
  position: fixed; top: var(--header-height); left: 0; bottom: 0;
  width: var(--sidebar-width); overflow-y: auto;
  padding: 20px 16px; border-right: 1px solid var(--border);
  background: var(--bg);
}
.doc-sidebar::-webkit-scrollbar { width: 4px; }
.doc-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar-section { margin-bottom: 24px; }
.sidebar-section h4 {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); margin-bottom: 8px; padding: 0 12px;
}
.sidebar-section a {
  display: block; padding: 7px 12px; border-radius: 8px; color: var(--text-muted);
  text-decoration: none; font-size: 0.85rem; transition: all .15s;
}
.sidebar-section a:hover { color: var(--text); background: var(--bg-card); }
.sidebar-section a.active { color: var(--primary-light); background: rgba(99,102,241,.1); font-weight: 600; }

/* ===== MAIN CONTENT ===== */
.doc-main {
  margin-left: var(--sidebar-width); margin-top: var(--header-height);
  padding: 40px 48px 80px; max-width: 900px;
}
.doc-main h1 {
  font-size: 2.4rem; font-weight: 800; margin-bottom: 12px;
  background: var(--gradient-primary); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.doc-main h2 {
  font-size: 1.6rem; font-weight: 700; margin: 48px 0 16px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border); color: var(--text);
}
.doc-main h3 { font-size: 1.2rem; font-weight: 600; margin: 32px 0 12px; color: var(--text); }
.doc-main p { margin-bottom: 16px; color: var(--text-muted); }
.doc-main ul, .doc-main ol { margin: 12px 0 20px 24px; color: var(--text-muted); }
.doc-main li { margin-bottom: 6px; }
.doc-main a { color: var(--primary-light); text-decoration: none; }
.doc-main a:hover { text-decoration: underline; }

/* Inline code */
.doc-main code:not(pre code) {
  background: var(--bg-code); padding: 2px 7px; border-radius: 5px;
  font-family: var(--font-mono); font-size: 0.85em; color: var(--accent);
  border: 1px solid var(--border);
}

/* Code blocks */
pre {
  background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; overflow-x: auto; margin: 16px 0 24px; position: relative;
}
pre code { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text); line-height: 1.6; }
.code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(255,255,255,.03); border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0; margin: -20px -20px 16px;
}
.code-header span { font-size: 0.8rem; color: var(--text-muted); font-family: var(--font-mono); }
.copy-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 0.75rem; transition: all .2s;
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary-light); }

/* Info boxes */
.info-box {
  padding: 16px 20px; border-radius: var(--radius); margin: 20px 0;
  border-left: 4px solid; font-size: 0.9rem;
}
.info-box.info { border-color: var(--primary); background: rgba(99,102,241,.08); }
.info-box.success { border-color: var(--success); background: rgba(34,197,94,.08); }
.info-box.warning { border-color: var(--warning); background: rgba(245,158,11,.08); }
.info-box.danger { border-color: var(--danger); background: rgba(239,68,68,.08); }
.info-box strong { color: var(--text); }

/* Tables */
.doc-table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 0.9rem; }
.doc-table th {
  text-align: left; padding: 12px 16px; background: var(--bg-card);
  border: 1px solid var(--border); font-weight: 600; color: var(--text); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: .5px;
}
.doc-table td { padding: 12px 16px; border: 1px solid var(--border); color: var(--text-muted); }
.doc-table tr:hover td { background: rgba(99,102,241,.03); }

/* Feature cards */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; margin: 20px 0; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: all .25s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,.1); }
.feature-card .icon { font-size: 1.5rem; margin-bottom: 10px; }
.feature-card h4 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.feature-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.badge-primary { background: rgba(99,102,241,.15); color: var(--primary-light); }
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }

/* Steps */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 48px; margin-bottom: 28px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 32px; height: 32px;
  border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
}
.step h4 { font-weight: 600; margin-bottom: 6px; color: var(--text); }
.step p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* Search */
.search-box {
  position: relative; margin-bottom: 20px;
}
.search-box input {
  width: 100%; padding: 10px 16px 10px 40px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  font-size: 0.875rem; outline: none; transition: border-color .2s;
}
.search-box input:focus { border-color: var(--primary); }
.search-box input::placeholder { color: var(--text-muted); }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 18px; height: 18px; }

/* Back to top */
.back-to-top {
  position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px;
  border-radius: 50%; background: var(--primary); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all .3s; z-index: 50;
  box-shadow: 0 4px 16px rgba(99,102,241,.3);
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: scale(1.1); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .doc-sidebar { transform: translateX(-100%); transition: transform .3s; z-index: 90; background: var(--bg); }
  .doc-sidebar.open { transform: translateX(0); }
  .doc-main { margin-left: 0; padding: 24px 20px 60px; }
  .mobile-menu-btn { display: block; }
  .doc-header nav { display: none; }
}

@media (max-width: 600px) {
  .doc-main h1 { font-size: 1.8rem; }
  .doc-main h2 { font-size: 1.3rem; }
  .feature-grid { grid-template-columns: 1fr; }
}

/* Transitions */
.doc-main section { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
