/* ===== CSS VARIABLES ===== */
:root {
  --primary-color: #0891b2;   /* teal — differentiates homelab from docs blue */
  --primary-dark: #0e7490;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --bg: #ffffff;
  --bg-light: #f0fdfa;
  --bg-dark: #0f172a;
  --border: #e2e8f0;
  --shadow: rgba(15, 23, 42, 0.08);
  --nav-height: 64px;
  --sidebar-width: 260px;
  --radius: 0.5rem;
  --radius-lg: 0.875rem;
  --font: 'Inter', sans-serif;
  --transition: 0.2s ease;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-light: #1e293b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --shadow: rgba(0,0,0,0.4);
}
[data-theme="dark"] .navbar       { background: rgba(15,23,42,0.97); border-bottom-color: #334155; }
[data-theme="dark"] .sidebar      { background: #111827; border-right-color: #334155; }
[data-theme="dark"] .sidebar-link { color: #94a3b8; }
[data-theme="dark"] .sidebar-link:hover,
[data-theme="dark"] .sidebar-link.active { background: #1e293b; color: #e2e8f0; }
[data-theme="dark"] .sidebar-group-title { color: #64748b; }
[data-theme="dark"] .card         { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .card h3      { color: #e2e8f0; }
[data-theme="dark"] .card p       { color: #94a3b8; }
[data-theme="dark"] .item-row     { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .item-row h4  { color: #e2e8f0; }
[data-theme="dark"] .item-row p   { color: #94a3b8; }
[data-theme="dark"] .item-row:hover { border-color: var(--primary-color); }
[data-theme="dark"] .badge-soon   { background: #1e293b; color: #64748b; border-color: #334155; }
[data-theme="dark"] .badge-new    { background: #0d2a2e; color: #22d3ee; border-color: #164e63; }
[data-theme="dark"] .section-hero { background: linear-gradient(135deg, #0a1628 0%, #0c2a30 60%, #0e7490 100%); }

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--font); color: var(--text-primary); background: var(--bg); line-height: 1.6; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; width: 100%; z-index: 200;
  height: var(--nav-height);
  background: rgba(255,255,255,0.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-logo a { font-size: 1.1rem; font-weight: 700; color: var(--primary-color); }
.nav-logo span { font-weight: 400; color: var(--text-secondary); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  font-size: 0.88rem; font-weight: 500; color: var(--text-secondary);
  padding: 0.35rem 0.75rem; border-radius: var(--radius);
  transition: all var(--transition);
}
.nav-links a:hover, .nav-links a.active { background: #ecfeff; color: var(--primary-color); }
.nav-right { display: flex; align-items: center; gap: 0.5rem; }
.nav-visit-main {
  font-size: 0.82rem; font-weight: 600; color: var(--primary-color);
  border: 1px solid var(--primary-color); padding: 0.3rem 0.85rem;
  border-radius: 999px; transition: all var(--transition);
}
.nav-visit-main:hover { background: var(--primary-color); color: white; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); font-size: 0.85rem; transition: all var(--transition);
}
.theme-toggle:hover { background: var(--primary-color); border-color: var(--primary-color); color: white; }
.hamburger { display: none; flex-direction: column; gap: 4px; cursor: pointer; padding: 4px; }
.hamburger span { width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: all var(--transition); }

/* ===== HERO ===== */
.section-hero {
  background: linear-gradient(135deg, #0f172a 0%, #0c2a30 60%, #0891b2 100%);
  padding: calc(var(--nav-height) + 28px) 2rem 40px;
  min-height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: white; text-align: center;
}
.section-hero h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.4rem; }
.section-hero p  { font-size: 0.95rem; color: #94a3b8; max-width: 560px; }
.breadcrumb { font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.35rem; justify-content: center; }
.breadcrumb a { color: #67e8f9; }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== DOCS LAYOUT ===== */
.docs-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width); min-width: var(--sidebar-width);
  background: var(--bg-light); border-right: 1px solid var(--border);
  position: fixed; top: var(--nav-height); left: 0;
  height: calc(100vh - var(--nav-height));
  overflow-y: auto; padding: 1.25rem 0;
  transition: transform var(--transition); z-index: 100;
}
.sidebar-group { margin-bottom: 1.5rem; }
.sidebar-group-title {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-light); padding: 0 1.1rem; margin-bottom: 0.35rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.875rem; color: var(--text-secondary);
  padding: 0.4rem 1.1rem; transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-link i { font-size: 0.8rem; width: 14px; text-align: center; color: var(--text-light); }
.sidebar-link:hover { background: #ecfeff; color: var(--primary-color); border-left-color: #a5f3fc; }
.sidebar-link:hover i, .sidebar-link.active i { color: var(--primary-color); }
.sidebar-link.active { background: #ecfeff; color: var(--primary-color); font-weight: 600; border-left-color: var(--primary-color); }

.docs-main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; padding: 2rem 2.5rem 4rem; }

/* ===== CARDS ===== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: 0 2px 10px var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(8,145,178,0.12); }
.card-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.4rem; }
.card p  { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 1rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.card-tag  { font-size: 0.75rem; background: var(--bg-light); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.6rem; }
.card-link { font-size: 0.875rem; font-weight: 600; color: var(--primary-color); display: inline-flex; align-items: center; gap: 0.35rem; transition: gap var(--transition); }
.card-link:hover { gap: 0.6rem; }

/* ===== ITEM ROWS ===== */
.item-row {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem; margin-bottom: 0.75rem;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.item-row:hover { border-color: var(--primary-color); box-shadow: 0 2px 10px rgba(8,145,178,0.08); }
.item-row-body { flex: 1; }
.item-row h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.2rem; }
.item-row p  { font-size: 0.85rem; color: var(--text-secondary); }
.item-row-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; flex-shrink: 0; }

/* ===== BADGES ===== */
.badge-soon { font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; background: #f1f5f9; color: #94a3b8; border: 1px solid var(--border); white-space: nowrap; }
.badge-new  { font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; background: #ecfeff; color: #0891b2; border: 1px solid #a5f3fc; white-space: nowrap; }
.badge-ext  { font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; white-space: nowrap; }

/* ===== CONTENT GROUPS ===== */
.content-group { margin-bottom: 2.5rem; }
.content-group-title {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-light);
  margin-bottom: 0.85rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}

/* ===== FOOTER ===== */
.docs-footer { background: var(--bg-dark); color: #94a3b8; padding: 1.5rem; text-align: center; font-size: 0.85rem; }
.docs-footer a { color: #67e8f9; }
.docs-footer a:hover { text-decoration: underline; }

/* ===== MOBILE BOTTOM NAV ===== */
.mobile-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: 62px; background: var(--bg); border-top: 1px solid var(--border);
  z-index: 150; padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px var(--shadow);
}
.mobile-bottom-nav-inner { display: flex; height: 62px; align-items: stretch; }
.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-light); font-size: 0.62rem; font-weight: 500;
  padding: 0.35rem 0.25rem; transition: color var(--transition), background var(--transition); min-height: 44px;
}
.mobile-nav-item i { font-size: 1.1rem; }
.mobile-nav-item:hover, .mobile-nav-item.active { color: var(--primary-color); background: #ecfeff; }
[data-theme="dark"] .mobile-bottom-nav { background: #0f172a; border-top-color: #334155; }
[data-theme="dark"] .mobile-nav-item:hover,
[data-theme="dark"] .mobile-nav-item.active { background: #1e293b; color: #22d3ee; }

/* ===== OVERLAY ===== */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 99; backdrop-filter: blur(2px); }
.sidebar-overlay.show { display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.15); }
  .docs-main { margin-left: 0; padding: 1.75rem 2rem 3rem; }
  .hamburger { display: flex; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .docs-main { padding: 1.5rem 1.25rem 5rem; }
  .section-hero { padding: 32px 1.5rem 32px; }
  .section-hero h1 { font-size: 1.5rem; }
}
@media (max-width: 640px) {
  .cat-grid { grid-template-columns: 1fr; }
  .nav-visit-main { display: none; }
  .mobile-bottom-nav { display: block; }
}
