/* ============================================================
   Linux Admin Toolkit — style.css
   Design language matches the companion cheat-sheet site:
   industrial minimalism, GitHub/Linear inspired, IBM Plex fonts.
   ============================================================ */

:root {
  --bg:            #0d1117;
  --bg-alt:        #161b22;
  --bg-card:       #1c2128;
  --bg-card-hover: #212830;
  --border:        #30363d;
  --border-light:  #21262d;
  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #6e7681;
  --accent:        #3fb950;
  --accent-dim:    #1a4426;
  --accent-glow:   rgba(63, 185, 80, 0.15);
  --red:           #f85149;
  --red-dim:       #3a1618;
  --amber:         #d29922;
  --amber-dim:     #3a2e0f;
  --blue:          #58a6ff;
  --blue-dim:      #0f2a44;
  --code-bg:       #161b22;
  --code-text:     #79c0ff;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --topbar-h:      58px;
  --sidebar-w:     240px;
  --font-body:     'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:     'IBM Plex Mono', 'Fira Code', ui-monospace, monospace;
  --transition:    0.16s ease;
}

[data-theme="light"] {
  --bg:            #ffffff;
  --bg-alt:        #f6f8fa;
  --bg-card:       #ffffff;
  --bg-card-hover: #f6f8fa;
  --border:        #d0d7de;
  --border-light:  #eaeef2;
  --text-primary:  #1f2328;
  --text-secondary:#656d76;
  --text-muted:    #9198a1;
  --accent:        #1a7f37;
  --accent-dim:    #dafbe1;
  --accent-glow:   rgba(26, 127, 55, 0.08);
  --red-dim:       #ffebe9;
  --amber-dim:     #fff8c5;
  --blue-dim:      #ddf4ff;
  --code-bg:       #f6f8fa;
  --code-text:     #0550ae;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.6;
  background: var(--bg); color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px;
}
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -50px; left: 8px; background: var(--accent); color: #06170a;
  padding: 8px 14px; border-radius: var(--radius-sm); z-index: 200; transition: top var(--transition);
  font-weight: 600;
}
.skip-link:focus { top: 8px; }

/* ---------- App shell ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  position: sticky; top: 0; z-index: 50;
}

.icon-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.icon-btn svg { width: 19px; height: 19px; }

.sidebar-toggle { display: none; }

.topbar-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-weight: 600; font-size: 15px;
  color: var(--text-primary); white-space: nowrap;
}
.topbar-logo:hover { text-decoration: none; }
.logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent-glow); color: var(--accent);
  font-family: var(--font-mono); font-size: 13px;
}
.logo-accent { color: var(--accent); }

.topbar-search {
  flex: 1; max-width: 420px; position: relative; margin-left: 8px;
}
.topbar-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}
.topbar-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13.5px; font-family: var(--font-body);
}
.topbar-search input:focus { border-color: var(--accent); outline: none; }

.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar-link { font-size: 13px; color: var(--text-secondary); padding: 6px 10px; border-radius: var(--radius-sm); }
.topbar-link:hover { background: var(--bg-card-hover); color: var(--text-primary); text-decoration: none; }

.icon-sun, .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: block; }

/* ---------- Body layout: sidebar + main ---------- */
.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  overflow-y: auto;
  padding: 14px 10px 30px;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.side-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.side-link:hover { background: var(--bg-card-hover); color: var(--text-primary); text-decoration: none; }
.side-link.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }
.side-link--top { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }

.side-group { margin-top: 4px; }
.side-group summary {
  list-style: none; cursor: pointer;
  padding: 6px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
  border-radius: var(--radius-sm);
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary:hover { color: var(--text-secondary); background: var(--bg-card-hover); }
.side-group summary::after { content: '\25BE'; transition: transform var(--transition); font-size: 10px; }
.side-group:not([open]) summary::after { transform: rotate(-90deg); }
.side-list { display: flex; flex-direction: column; gap: 1px; padding-left: 4px; }

.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot--available { background: var(--accent); }
.status-dot--soon { background: var(--text-muted); }

.sidebar-scrim { display: none; }

.main-content {
  padding: 28px 32px 60px;
  min-width: 0;
  outline: none;
}

/* ---------- Page head ---------- */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.page-sub { color: var(--text-secondary); font-size: 14.5px; max-width: 640px; }
.back-link { display: inline-block; font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.back-link:hover { color: var(--accent); }

.status-strip { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.status-strip li { font-size: 12.5px; color: var(--accent); font-family: var(--font-mono); }

.section-heading {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin: 26px 0 12px;
}
section:first-of-type .section-heading { margin-top: 0; }

/* ---------- Cards / dashboard ---------- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px;
}
.tool-card {
  display: block; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg-card); color: var(--text-primary);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.tool-card:hover { border-color: var(--accent); background: var(--bg-card-hover); text-decoration: none; transform: translateY(-1px); }
.tool-card-top { margin-bottom: 8px; }
.tool-card-title { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.tool-card-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }

.badge {
  display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 999px; text-transform: uppercase;
}
.badge--available { background: var(--accent-glow); color: var(--accent); }
.badge--soon { background: var(--border-light); color: var(--text-muted); }

.empty-state {
  border: 1px dashed var(--border); border-radius: var(--radius-md);
  padding: 28px; text-align: center; color: var(--text-secondary); font-size: 14px;
}
.empty-state-title { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; font-size: 15px; }

/* ---------- LVM tool layout ---------- */
.lvm-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.lvm-input-col { display: flex; flex-direction: column; gap: 14px; }
.lvm-result-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.field-card {
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card);
  padding: 12px 14px;
}
.field-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.field-card label, .lvm-grid label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-hint { color: var(--text-muted); font-weight: 400; font-size: 12px; }

.field-card--quick-paste { border-color: var(--accent); background: var(--accent-glow); }
.quick-paste-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.detected-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.input-terminal, .input-text {
  width: 100%; background: var(--code-bg); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--code-text); font-family: var(--font-mono); font-size: 12.5px; padding: 10px 12px;
  resize: vertical; line-height: 1.5;
}
.input-terminal:focus, .input-text:focus { border-color: var(--accent); outline: none; }
.input-text { width: auto; flex: 1; }

.inline-field { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #06170a; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn--ghost:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.btn--sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Results ---------- */
.result-card {
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card);
  padding: 16px;
}
.result-card-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

.fact-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.fact-row {
  display: grid; grid-template-columns: 170px 1fr; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 13px;
}
.fact-row:last-child { border-bottom: none; }
.fact-row dt { color: var(--text-secondary); }
.fact-row dd { font-family: var(--font-mono); color: var(--text-primary); word-break: break-word; }
.fact-missing { font-family: var(--font-body); color: var(--text-muted); font-style: italic; }

.callout {
  border-radius: var(--radius-md); padding: 12px 14px; border: 1px solid;
}
.callout-title { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.callout ul { padding-left: 18px; list-style: disc; }
.callout li { font-size: 13px; margin: 2px 0; line-height: 1.5; }
.callout--info { background: var(--blue-dim); border-color: var(--blue); color: var(--text-primary); }
.callout--info .callout-title { color: var(--blue); }
.callout--error { background: var(--red-dim); border-color: var(--red); color: var(--text-primary); }
.callout--error .callout-title { color: var(--red); }
.callout--warn { background: var(--amber-dim); border-color: var(--amber); color: var(--text-primary); }
.callout--warn .callout-title { color: var(--amber); }

/* ---------- Terminal / command output ---------- */
.terminal-box { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-top: 10px; }
.terminal-box-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-alt); padding: 6px 10px; font-size: 11.5px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.terminal-code {
  background: var(--code-bg); color: var(--code-text); font-family: var(--font-mono);
  font-size: 13px; padding: 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.terminal-code--sm { font-size: 12px; padding: 10px 12px; }

.alt-details { margin-top: 10px; }
.alt-details summary { cursor: pointer; font-size: 13px; color: var(--text-secondary); padding: 6px 0; }
.alt-details summary:hover { color: var(--text-primary); }

.explain-grid { display: grid; gap: 14px; margin-top: 16px; }
.explain-grid h3 { font-size: 13px; margin-bottom: 6px; }
.explain-grid p, .explain-grid li { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.explain-grid ul { padding-left: 18px; list-style: disc; }

/* ---------- Footer ---------- */
.app-footer {
  border-top: 1px solid var(--border); background: var(--bg-alt);
  padding: 16px 24px; text-align: center; font-size: 12px; color: var(--text-muted);
}
.app-footer-meta { margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 260px;
    transform: translateX(-100%); transition: transform var(--transition); z-index: 90;
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-md); }
  .sidebar-scrim {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,0.4); z-index: 80;
  }
  .app-shell.sidebar-open .sidebar-scrim { display: block; }
  .topbar-search { max-width: none; }
  .topbar-link { display: none; }
  .lvm-grid { grid-template-columns: 1fr; }
  .main-content { padding: 20px 16px 50px; }
  .fact-row { grid-template-columns: 140px 1fr; }
}

@media (max-width: 480px) {
  .fact-row { grid-template-columns: 1fr; }
}
