/* ============================================================
   SchemaGraphos Help — Styles
   ============================================================ */

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-light: #718096;
  --bg: #f7fafc;
  --bg-white: #ffffff;
  --border: #e2e8f0;
  --sidebar-w: 280px;
  --topbar-h: 60px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --radius: 8px;
  --transition: all .2s ease;
  --code-bg: #f0f4ff;
  --tip-bg: #e8f5e9;
  --tip-border: #43a047;
  --warn-bg: #fff8e1;
  --warn-border: #f9a825;
  --info-bg: #e3f2fd;
  --info-border: #1e88e5;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* ── Top Bar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}


.topbar-divider {
  width: 1px; height: 24px;
  background: var(--border);
}

.topbar-title {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: .45rem 1rem .45rem 2.4rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .875rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.topbar-search input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

.topbar-search .search-icon {
  position: absolute;
  left: .75rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.topbar-search .search-icon svg { width: 15px; height: 15px; }

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

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

.search-result-item {
  padding: .65rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg); }

.search-result-item .result-title {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

.search-result-item .result-section {
  font-size: .75rem;
  color: var(--text-light);
  margin-top: 2px;
}

.search-result-item mark {
  background: rgba(102,126,234,.2);
  color: var(--primary-dark);
  border-radius: 2px;
  padding: 0 2px;
}

.topbar-lang {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .75rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}

.topbar-lang:hover { border-color: var(--primary); color: var(--primary); }
.topbar-lang svg { width: 14px; height: 14px; }

.topbar-app-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--gradient);
  color: white;
  border-radius: 20px;
  padding: .35rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .2s;
  white-space: nowrap;
}

.topbar-app-link:hover { opacity: .88; }
.topbar-app-link svg { width: 13px; height: 13px; }

/* ── Layout ── */
.layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 1.25rem 0;
}

.sidebar-section { margin-bottom: .25rem; }

.sidebar-section-title {
  padding: .4rem 1.25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem 1.25rem;
  font-size: .85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: var(--transition);
}

.sidebar-link:hover { background: var(--bg); color: var(--text); }

.sidebar-link.active {
  background: rgba(102,126,234,.08);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-link svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.sidebar-link.active svg { opacity: 1; }

/* ── Main Content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: 900px;
}

/* ── Sections ── */
.help-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: calc(var(--topbar-h) + 1.5rem);
}

.section-hero {
  background: var(--gradient);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  margin-bottom: 3rem;
  color: white;
}

.section-hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: .5rem;
}

.section-hero p {
  font-size: 1rem;
  opacity: .88;
  max-width: 540px;
}

h2.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  padding-bottom: .65rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

h2.section-title svg { width: 20px; height: 20px; color: var(--primary); }

h3.subsection-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.5rem 0 .6rem;
}

p { margin-bottom: .85rem; color: var(--text-muted); font-size: .9rem; }
p:last-child { margin-bottom: 0; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; margin-bottom: 1.25rem; }

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

th {
  background: var(--bg);
  padding: .6rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

td strong, td code { color: var(--text); }

/* ── Code / Badges ── */
code {
  background: var(--code-bg);
  color: var(--primary-dark);
  padding: .1em .4em;
  border-radius: 4px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: .82em;
}

.kbd {
  display: inline-flex;
  align-items: center;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: .1rem .5rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  font-family: monospace;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* ── Callouts ── */
.callout {
  display: flex;
  gap: .75rem;
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin-bottom: 1.1rem;
  font-size: .875rem;
}

.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.callout-tip { background: var(--tip-bg); border-left: 4px solid var(--tip-border); }
.callout-tip svg { color: var(--tip-border); }

.callout-warn { background: var(--warn-bg); border-left: 4px solid var(--warn-border); }
.callout-warn svg { color: var(--warn-border); }

.callout-info { background: var(--info-bg); border-left: 4px solid var(--info-border); }
.callout-info svg { color: var(--info-border); }

.callout p { margin: 0; color: var(--text); }

/* ── Step List ── */
.steps { list-style: none; counter-reset: step; margin-bottom: 1.25rem; }

.steps li {
  display: flex;
  gap: .85rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text-muted);
  counter-increment: step;
}

.steps li:last-child { border-bottom: none; }

.steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  min-width: 22px;
  background: var(--gradient);
  color: white;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 700;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-critical { background: #fde8e8; color: #c0392b; }
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-info     { background: var(--info-bg); color: var(--info-border); }
.badge-success  { background: var(--tip-bg); color: var(--tip-border); }
.badge-primary  { background: rgba(102,126,234,.12); color: var(--primary-dark); }

/* ── Feature Cards ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.feature-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  transition: var(--transition);
}

.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.feature-card .fc-icon {
  width: 36px; height: 36px;
  background: rgba(102,126,234,.1);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .7rem;
}

.feature-card .fc-icon svg { width: 18px; height: 18px; stroke: var(--primary); }

.feature-card h4 {
  font-size: .875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .3rem;
}

.feature-card p {
  font-size: .8rem;
  color: var(--text-light);
  margin: 0;
}

/* ── Shortcuts ── */
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  color: var(--text-muted);
}

.shortcut-row:last-child { border-bottom: none; }
.shortcut-keys { display: flex; gap: .3rem; }

/* ── Mobile sidebar toggle ── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  color: var(--text-muted);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 90;
}

/* ── Back to top ── */
.back-to-top {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  width: 40px; height: 40px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 80;
}

.back-to-top.visible { opacity: 1; pointer-events: all; }
.back-to-top svg { width: 18px; height: 18px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .main { padding: 1.75rem 1.5rem; }
}

@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .topbar-title { display: none; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 95;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; padding: 1.25rem 1rem; }

  .topbar-app-link span { display: none; }
}
