/* ============================================================
   i9Drive — Documentation Site Styles
   Design: Dark Navy + Teal/Cyan accent (matches logo palette)
   ============================================================ */

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

:root {
  --sidebar-w: 280px;
  --topbar-h: 56px;

  /* Colors */
  --bg-base:        #0b0f1a;
  --bg-sidebar:     #0d1120;
  --bg-sidebar-hover: #151c30;
  --bg-content:     #111827;
  --bg-card:        #161f35;
  --bg-code:        #0d1117;

  --accent-primary:  #00c2cb;   /* teal — from logo */
  --accent-secondary:#2563eb;   /* blue */
  --accent-glow:     rgba(0,194,203,0.15);

  --text-primary:   #e8edf5;
  --text-secondary: #8b9bb8;
  --text-muted:     #526080;

  --border:         rgba(255,255,255,0.07);
  --border-accent:  rgba(0,194,203,0.4);

  --active-bg:      rgba(0,194,203,0.12);
  --active-border:  var(--accent-primary);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(0,194,203,0.06) 0%, transparent 100%);
}

.logo {
  width: 180px;
  height: auto;
  filter: drop-shadow(0 0 16px rgba(0,194,203,0.3));
  transition: filter var(--transition);
}
.logo:hover { filter: drop-shadow(0 0 24px rgba(0,194,203,0.5)); }

.logo-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── NAVIGATION ──────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

/* Direct nav items */
a.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-sidebar-hover);
  border-left-color: rgba(0,194,203,0.3);
}
a.nav-item.active {
  color: var(--accent-primary);
  background: var(--active-bg);
  border-left-color: var(--active-border);
  font-weight: 600;
}
a.nav-item.sub {
  padding-left: 44px;
  font-size: 13px;
  font-weight: 400;
}
a.nav-item.sub.active {
  color: var(--accent-primary);
  background: var(--active-bg);
  border-left-color: var(--active-border);
  font-weight: 500;
}

.nav-icon { font-size: 15px; flex-shrink: 0; }

/* ── ACCORDION GROUP ─────────────────────────────────────── */
.nav-group { border-bottom: 1px solid var(--border); }

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.nav-group-header:hover {
  color: var(--text-primary);
  background: var(--bg-sidebar-hover);
}
.nav-group-header.open {
  color: var(--accent-primary);
}

.chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.nav-group-header.open .chevron {
  transform: rotate(90deg);
  color: var(--accent-primary);
}

.nav-group-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1),
              opacity 0.25s ease;
  opacity: 0;
  background: rgba(0,0,0,0.15);
}
.nav-group-body.open {
  max-height: 500px;
  opacity: 1;
}

/* ── SIDEBAR FOOTER ──────────────────────────────────────── */
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ── MOBILE TOGGLE ───────────────────────────────────────── */
#sidebarToggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
#sidebarToggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-content);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: rgba(13,17,32,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0; z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  gap: 16px;
}

#breadcrumb {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
#breadcrumb .crumb { color: var(--text-muted); }
#breadcrumb .crumb-current { color: var(--accent-primary); font-weight: 600; }
#breadcrumb .sep { color: var(--text-muted); }

#version-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--active-bg);
  color: var(--accent-primary);
  border: 1px solid var(--border-accent);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

/* ── CONTENT WRAPPER ─────────────────────────────────────── */
#content-wrapper {
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

/* ── LOADING ─────────────────────────────────────────────── */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 0;
  color: var(--text-muted);
}
#loading.hidden { display: none; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ARTICLE / MARKDOWN ──────────────────────────────────── */
#content {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

#content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-accent);
  background: linear-gradient(135deg, #e8edf5 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

#content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

#content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin: 28px 0 12px;
}

#content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 20px 0 8px;
}

#content p {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

#content a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,194,203,0.3);
  transition: border-color var(--transition);
}
#content a:hover { border-bottom-color: var(--accent-primary); }

#content strong { color: var(--text-primary); font-weight: 600; }
#content em { color: var(--accent-primary); font-style: italic; }

/* ── BLOCKQUOTE ──────────────────────────────────────────── */
#content blockquote {
  border-left: 3px solid var(--accent-primary);
  background: var(--bg-card);
  padding: 14px 18px;
  margin: 20px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px;
}
#content blockquote p { margin: 0; color: var(--text-secondary); }
#content blockquote strong { color: var(--accent-primary); }

/* ── TABLES ──────────────────────────────────────────────── */
#content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13.5px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
#content thead tr {
  background: linear-gradient(90deg, rgba(0,194,203,0.15), rgba(37,99,235,0.1));
  border-bottom: 1px solid var(--border-accent);
}
#content th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
}
#content td {
  padding: 10px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
#content tr:last-child td { border-bottom: none; }
#content tr:hover td { background: rgba(255,255,255,0.02); }
#content tbody tr:nth-child(even) { background: rgba(255,255,255,0.02); }

/* ── CODE ────────────────────────────────────────────────── */
#content code:not(pre code) {
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  background: rgba(0,194,203,0.1);
  color: var(--accent-primary);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0,194,203,0.2);
}

#content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
  position: relative;
  font-size: 13px;
  line-height: 1.6;
}
#content pre::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
#content pre code {
  font-family: 'Fira Code', monospace;
  background: none;
  color: #c9d1d9;
  padding: 0;
  border: none;
  font-size: 13px;
}

/* ── LISTS ───────────────────────────────────────────────── */
#content ul, #content ol {
  padding-left: 24px;
  margin: 12px 0;
}
#content li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
#content li::marker { color: var(--accent-primary); }

/* ── HORIZONTAL RULE ─────────────────────────────────────── */
#content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

/* ── CHECKBOX LISTS ──────────────────────────────────────── */
#content input[type="checkbox"] {
  accent-color: var(--accent-primary);
  margin-right: 8px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }
  #main { margin-left: 0; }
  #sidebarToggle { display: flex; }
  #content-wrapper { padding: 24px 20px 60px; }
  #topbar { padding: 0 20px 0 60px; }
}

/* ── OVERLAY for mobile ──────────────────────────────────── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
#overlay.visible { display: block; }

/* ── SCROLL PROGRESS BAR ─────────────────────────────────── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  z-index: 9999;
  width: 0%;
  transition: width 0.1s;
}
