/* ============================================================
   Webpamati.lv - Galvenais stilu fails
   ============================================================ */

:root {
  --primary: #dc6b2f;
  --primary-dark: #b84e18;
  --primary-light: #fff4ed;
  --secondary: #d97706;
  --bg: #fdf6ee;
  --bg-white: #fffcf9;
  --sidebar-bg: #1a0f06;
  --sidebar-text: #c4a87e;
  --sidebar-hover: #2d1c0e;
  --sidebar-active: #dc6b2f;
  --text: #2c1a0e;
  --text-muted: #8b6040;
  --border: #edddc8;
  --code-bg: #160d05;
  --code-text: #f5dcb8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(180,90,30,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 18px rgba(180,90,30,0.12), 0 2px 4px rgba(0,0,0,0.06);
  --transition: 0.2s ease;
  --sidebar-width: 272px;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #120a04;
  --bg-white: #1e1208;
  --text: #f5dcb8;
  --text-muted: #9a7258;
  --border: #3a2010;
  --primary-light: #3a1a08;
  --shadow: 0 1px 4px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  display: flex;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ============================================================
   SIDEBAR NAVIGĀCIJA
   ============================================================ */

#sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #4a2c14; border-radius: 2px; }

.sidebar-logo {
  padding: 26px 22px 22px;
  border-bottom: 1px solid #2d1c0e;
  text-decoration: none;
  display: block;
  background: linear-gradient(160deg, #120800 0%, #1a0f06 100%);
}

.sidebar-logo h1 {
  color: #f5dcb8;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sidebar-logo span {
  color: #dc6b2f;
}

.sidebar-logo p {
  font-size: 0.74rem;
  color: #6b4828;
  margin-top: 5px;
}

.sidebar-section-title {
  padding: 18px 22px 6px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #5a3820;
}

/* ---- AKORDEONS ---- */
.nav-group {
  margin: 2px 0;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 22px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  letter-spacing: 0.01em;
}

.nav-group-toggle:hover {
  background: var(--sidebar-hover);
  color: #f5dcb8;
}

.nav-group-toggle.open {
  color: #f5dcb8;
  background: rgba(220, 107, 47, 0.12);
  border-left-color: #dc6b2f;
}

.nav-arrow {
  width: 14px;
  height: 14px;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  opacity: 0.6;
}

.nav-group-toggle.open .nav-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.nav-group-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-group-items.open {
  max-height: 800px;
}

.nav-group-items a {
  padding-left: 36px !important;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 22px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

#sidebar nav a:hover {
  background: var(--sidebar-hover);
  color: #f5dcb8;
}

#sidebar nav a.active {
  background: rgba(220, 107, 47, 0.18);
  color: #f4a96a;
  border-left-color: #dc6b2f;
  font-weight: 600;
}

#sidebar nav a .nav-icon {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: #2d1c0e;
  color: #7a5030;
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 99px;
}

.sidebar-divider {
  height: 1px;
  background: #2d1c0e;
  margin: 10px 0;
}

/* ============================================================
   GALVENAIS SATURS
   ============================================================ */

#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */

#header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
  transition: background var(--transition);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

#menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
  font-size: 1.3rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}

#menu-toggle:hover {
  background: var(--border);
}

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

#breadcrumb a:hover { text-decoration: underline; }

#breadcrumb .sep {
  color: var(--border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#search-input {
  padding: 8px 14px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  width: 220px;
  outline: none;
  transition: border-color var(--transition), width var(--transition);
}

#search-input:focus {
  border-color: var(--primary);
  width: 280px;
}

.search-wrap {
  position: relative;
}

.search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 8px 12px;
  color: var(--text);
  font-size: 1rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}

#theme-toggle:hover {
  background: var(--border);
}

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}

#search-results.visible { display: block; }

#search-results a {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

#search-results a:last-child { border-bottom: none; }
#search-results a:hover { background: var(--primary-light); color: var(--primary); }
#search-results a small { display: block; color: var(--text-muted); font-size: 0.75rem; }

/* ============================================================
   SATURS
   ============================================================ */

.page-content {
  padding: 40px 48px;
  max-width: 1000px;
  width: 100%;
}

.page-hero {
  background: linear-gradient(140deg, #b84e18 0%, #8c3610 50%, #1a0f06 100%);
  color: white;
  padding: 64px 48px;
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 90% 0%, rgba(220,107,47,0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 100%, rgba(80,30,10,0.6) 0%, transparent 50%);
  pointer-events: none;
}

.page-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 12px;
  position: relative;
}

.page-hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
  line-height: 1.6;
}

.hero-badges {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.hero-badge {
  background: rgba(255,255,255,0.1);
  color: #ffd9b8;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,180,100,0.2);
}

/* Topic cards on home page */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 40px 48px;
}

.topic-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  box-shadow: var(--shadow);
  display: block;
}

.topic-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  box-shadow: var(--shadow);
  display: block;
}

.topic-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(180, 78, 24, 0.16);
  transform: translateY(-3px);
}

.topic-card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.topic-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.topic-card p {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.topic-card-tag {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}

.tag-php { background: #fff4ed; color: #9a3412; border: 1px solid #fed7aa; }
.tag-js { background: #fefce8; color: #78350f; border: 1px solid #fde68a; }
.tag-python { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.tag-sql    { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.tag-ai     { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.lang-sql  .lang-dot { background: #f97316; }

/* ============================================================
   SADAĻU LAPAS
   ============================================================ */

.topic-header {
  padding: 40px 48px 0;
  max-width: 1000px;
}

.topic-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.topic-header p.lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 700px;
}

.topic-header .topic-meta {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.topic-meta span {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.section {
  padding: 32px 48px;
  max-width: 1000px;
}

.section + .section {
  padding-top: 0;
}

.section h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.3px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section h2::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #f4a96a);
  border-radius: 2px;
  flex-shrink: 0;
}

.section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text);
}

.section p {
  margin-bottom: 14px;
  color: var(--text);
}

/* ============================================================
   KODA BLOKI
   ============================================================ */

.code-block {
  background: var(--code-bg);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid #2d1c0e;
}

.code-header {
  background: #1e1008;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #2d1c0e;
}

.code-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: #8b6040;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.lang-php .lang-dot { background: #818cf8; }
.lang-js .lang-dot { background: #fbbf24; }
.lang-html .lang-dot { background: #f97316; }
.lang-css .lang-dot { background: #38bdf8; }
.lang-sql .lang-dot { background: #4ade80; }
.lang-python .lang-dot { background: #60a5fa; }
.lang-bash .lang-dot { background: #a3e635; }
.lang-json .lang-dot { background: #facc15; }
.lang-xml .lang-dot { background: #fb7185; }
.lang-markdown .lang-dot { background: #c084fc; }
.lang-text .lang-dot { background: #a8a29e; }

.copy-btn {
  background: none;
  border: 1px solid #2d1c0e;
  color: #8b6040;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--transition);
  font-family: inherit;
}

.copy-btn:hover {
  background: #2d1c0e;
  color: #f4a96a;
  border-color: #4a2c14;
}

.copy-btn.copied {
  color: #86efac;
  border-color: #86efac;
}

.code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--code-text);
}

.code-block pre::-webkit-scrollbar {
  height: 4px;
}

.code-block pre::-webkit-scrollbar-track { background: #1e1008; }
.code-block pre::-webkit-scrollbar-thumb { background: #4a2c14; border-radius: 2px; }

.cookie-banner {
  position: fixed;
  z-index: 1000;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: auto;
  padding: 18px 22px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 35px rgba(40, 24, 12, .2);
}
[hidden] { display: none !important; }
.cookie-banner h2, .cookie-dialog h2 { margin: 0 0 6px; font-size: 1.05rem; }
.cookie-banner p, .cookie-dialog p { margin: 0; max-width: 720px; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.cookie-actions .button { display: inline-block; padding: 8px 12px; color: #fff; font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.4; text-decoration: none; border: 1px solid var(--primary); border-radius: 6px; cursor: pointer; transition: background var(--transition), border-color var(--transition), color var(--transition); }
.cookie-actions .button:not(.secondary) { background: var(--primary); }
.cookie-actions .button:not(.secondary):hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.cookie-actions a { display: inline-block; padding: 8px 12px; color: var(--primary); font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; border: 1px solid transparent; border-radius: 6px; transition: background var(--transition), color var(--transition), border-color var(--transition); }
.cookie-actions a:hover { color: var(--primary-dark); background: var(--primary-light); border-color: var(--border); }
.cookie-banner .secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.cookie-banner .secondary:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.cookie-actions .button:focus-visible, .cookie-actions a:focus-visible { outline: 3px solid rgba(220, 107, 47, .35); outline-offset: 2px; }
.cookie-dialog { position: fixed; z-index: 1001; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .45); }
.cookie-dialog-inner { position: relative; width: min(560px, 100%); padding: 28px; background: var(--bg-white); border-radius: 8px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.cookie-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: var(--text); font-size: 1.8rem; cursor: pointer; }
.cookie-choice { display: block; margin: 20px 0 10px; font-weight: 600; }
.cookie-muted { color: var(--muted); font-size: .9rem; margin-bottom: 18px !important; }
.legal-page { max-width: 1000px; }
.legal-page .section { max-width: 900px; }
.legal-page li { margin-bottom: 8px; }
@media (max-width: 700px) { .cookie-banner { display: block; } .cookie-actions { margin-top: 14px; justify-content: flex-start; } }

/* Syntax highlighting */
.kw { color: #ff8c65; font-weight: 600; }
.fn { color: #ffb347; }
.str { color: #a8d878; }
.num { color: #ff9a6c; }
.cmt { color: #6b4828; font-style: italic; }
.var { color: #ffc896; }
.op { color: #8b6040; }
.cls { color: #ffd54f; }
.bool { color: #ff9a6c; font-weight: 600; }
.tag { color: #ff8a50; }
.attr { color: #ffcc80; }
.atr-val { color: #a8d878; }

/* ============================================================
   PIEZĪMJU BLOKI (info, brīdinājumi utt.)
   ============================================================ */

.note {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 18px 0;
  border-left: 4px solid;
  font-size: 0.9rem;
  line-height: 1.6;
}

.note-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.note-body strong { display: block; margin-bottom: 4px; }

.note-info { background: #fff8f2; border-color: var(--primary); color: var(--text); }
[data-theme="dark"] .note-info { background: #2d1a08; }
.note-info .note-icon { color: var(--primary); }

.note-warning { background: #fffbeb; border-color: var(--warning); }
[data-theme="dark"] .note-warning { background: #2d2000; }
.note-warning .note-icon { color: var(--warning); }

.note-success { background: #f0fdf4; border-color: var(--success); }
[data-theme="dark"] .note-success { background: #052e16; }
.note-success .note-icon { color: var(--success); }

.note-danger { background: #fef2f2; border-color: var(--danger); }
[data-theme="dark"] .note-danger { background: #2d0000; }
.note-danger .note-icon { color: var(--danger); }

/* ============================================================
   TABULAS
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: linear-gradient(90deg, #b84e18 0%, #8c3610 100%);
  color: white;
}

th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }

tbody tr:hover { background: #fff8f2; }
[data-theme="dark"] tbody tr:hover { background: #2d1a08; }

td code, th code {
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

/* ============================================================
   TABS (dalītāji starp apakštēmām)
   ============================================================ */

.subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.subtab {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.subtab:hover { color: var(--primary); }

.subtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.subtab-content { display: none; }
.subtab-content.active { display: block; }

/* ============================================================
   PROGRESS BAR (virsraksta sadaļai)
   ============================================================ */

#read-progress {
  position: sticky;
  top: 64px;
  z-index: 49;
  height: 4px;
  background: var(--border);
  overflow: visible;
}

#read-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #dc6b2f, #f4a96a);
  width: 0%;
  transition: width 0.4s ease;
  position: relative;
}

#read-progress-label {
  position: absolute;
  right: 12px;
  top: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-white);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 99px;
  line-height: 1.4;
  pointer-events: none;
  transition: opacity 0.3s;
}

/* ============================================================
   NAVIGĀCIJA LAPĀ (iepriekšējā / nākamā)
   ============================================================ */

.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 48px;
  max-width: 1000px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.page-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.875rem;
  transition: all var(--transition);
  flex: 1;
  max-width: 45%;
  box-shadow: var(--shadow);
}

.page-nav a:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 4px 16px rgba(180,78,24,0.14);
}

.page-nav a.next { justify-content: flex-end; text-align: right; }
.page-nav a span { font-size: 0.75rem; color: var(--text-muted); display: block; }
.page-nav a strong { display: block; font-size: 0.9rem; }

/* ============================================================
   INLINE KODS
   ============================================================ */

p code, li code, td code {
  background: #fff4ed;
  color: #9a3412;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.85em;
  border: 1px solid #fecba2;
}

[data-theme="dark"] p code, [data-theme="dark"] li code {
  background: #2d1a08;
  color: #f4a96a;
  border-color: #4a2c14;
}

/* ============================================================
   SARAKSTI
   ============================================================ */

.section ul, .section ol {
  padding-left: 24px;
  margin-bottom: 14px;
}

.section li {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.92rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  background: linear-gradient(135deg, #120800 0%, #1a0f06 100%);
  color: #6b4828;
  padding: 32px 48px;
  font-size: 0.82rem;
  margin-top: auto;
  border-top: 1px solid #2d1c0e;
}

footer p { margin-bottom: 6px; }

footer a {
  color: #f4a96a;
  text-decoration: none;
}

footer a:hover { text-decoration: underline; color: #f5dcb8; }

/* ============================================================
   CHIP / BADGES
   ============================================================ */

.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.chip-blue { background: #fff4ed; color: #9a3412; border: 1px solid #fecba2; }
.chip-yellow { background: #fefce8; color: #854d0e; border: 1px solid #fde68a; }
.chip-green { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }

  #sidebar {
    transform: translateX(-280px);
    width: 280px;
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vw rgba(0,0,0,0.4);
  }

  #main-content {
    margin-left: 0;
  }

  #menu-toggle {
    display: block;
  }

  .page-content, .section, .topic-header, .page-nav {
    padding-left: 20px;
    padding-right: 20px;
  }

  .topic-grid {
    padding: 20px;
    grid-template-columns: 1fr;
  }

  .page-hero {
    padding: 40px 20px;
  }

  .page-hero h1 { font-size: 1.8rem; }

  #search-input { width: 160px; }
  #search-input:focus { width: 180px; }

  .page-nav {
    flex-direction: column;
  }

  .page-nav a { max-width: 100%; }
}

/* ============================================================
   ANIMĀCIJAS
   ============================================================ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* ============================================================
   HIGHLIGHT AKTĪVĀS VIRSRAKSTU
   ============================================================ */

.section h2 { scroll-margin-top: 80px; }
.section h3 { scroll-margin-top: 80px; }

/* ============================================================
   SATURA RĀDĪTĀJS (Table of Contents)
   ============================================================ */

.toc {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  max-width: 400px;
}

.toc h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc ol {
  padding-left: 20px;
}

.toc li {
  margin-bottom: 6px;
}

.toc a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
}

.toc a:hover { text-decoration: underline; }

/* ============================================================
   HOMESCREEN STATISTIKA
   ============================================================ */

.stats-bar {
  display: flex;
  gap: 24px;
  padding: 24px 48px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-item .num {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #f4a96a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-item .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Two column layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 16px 0;
}

@media (max-width: 650px) {
  .two-col { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

/* Highlight box */
.highlight-box {
  background: linear-gradient(135deg, #fff8f2, #fff4ed);
  border: 1px solid #fecba2;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 16px 0;
}

[data-theme="dark"] .highlight-box {
  background: linear-gradient(135deg, #2d1a08, #231408);
  border-color: #4a2c14;
}

.highlight-box h4 {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

/* Definition list */
dl.definitions { margin: 16px 0; }
dl.definitions dt {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
dl.definitions dt::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--primary);
  border-radius: 50%;
}
dl.definitions dd {
  margin-left: 16px;
  margin-bottom: 14px;
  font-size: 0.875rem;
  color: var(--text);
}

/* Separator */
.sep-line {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}
