/* SAP Knowledge Base — Design System */
/* LG red accent (#e30030) + Fraunces+Geist + Slate base */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;1,9..144,300&family=Geist:wght@300;400;500;600&family=Geist+Mono:wght@400&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg:          #f2f4f7;
  --surface:     #ffffff;
  --border:      rgba(30,40,60,0.09);
  --ink:         #1a2035;
  --ink-muted:   #6b7591;
  --ink-faint:   #b0b8cc;
  --accent:      #e30030;
  --accent-dim:  rgba(227,0,48,0.08);
  --accent-dark: #b80025;

  --radius:   6px;
  --shadow:   0 1px 3px rgba(30,40,60,0.08), 0 4px 16px rgba(30,40,60,0.04);
  --shadow-lg: 0 4px 24px rgba(30,40,60,0.12);

  /* Domain colours */
  --sd:   #e30030;
  --mm:   #1a6eb5;
  --fi:   #0d7c4d;
  --pp:   #7c3d8c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #111318;
    --surface:    #191c24;
    --border:     rgba(255,255,255,0.07);
    --ink:        #e8edf8;
    --ink-muted:  #8891aa;
    --ink-faint:  #363c50;
    --accent:     #ff1a47;
    --accent-dim: rgba(255,26,71,0.1);
    --accent-dark:#e30030;
  }
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Geist', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 300; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
h1 em, h2 em, h3 em { color: var(--accent); font-style: italic; }

p { color: var(--ink-muted); line-height: 1.7; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: 'Geist Mono', monospace; font-size: 0.88em; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; overflow-x: auto; }
code { background: var(--accent-dim); color: var(--accent-dark); padding: 0.1em 0.35em; border-radius: 3px; }
pre code { background: none; color: inherit; padding: 0; }

/* ── Layout ──────────────────────────────────────────────── */
.container { max-width: 1140px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }
.container--narrow { max-width: 760px; }

/* ── Navigation ──────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(242,244,247,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .nav { background: rgba(17,19,24,0.85); }
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.nav__logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}
.nav__logo-badge {
  background: var(--accent);
  color: #fff;
  font-family: 'Geist Mono', monospace;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  padding: 0.15em 0.45em;
  border-radius: 3px;
}
.nav__search {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
}
.nav__search form {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  gap: 0.5rem;
  transition: border-color 0.15s;
}
.nav__search form:focus-within { border-color: var(--accent); }
.nav__search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: 'Geist', sans-serif;
  font-size: 0.9rem;
  outline: none;
}
.nav__search input::placeholder { color: var(--ink-faint); }
.nav__search button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}
.nav__search button:hover { background: var(--accent-dark); }
.nav__links { display: flex; gap: 1.25rem; align-items: center; }
.nav__links a { font-size: 0.88rem; color: var(--ink-muted); transition: color 0.15s; white-space: nowrap; }
.nav__links a:hover { color: var(--ink); text-decoration: none; }
.nav__links a.active { color: var(--accent); }
.nav__user { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.nav__user span { font-size: 0.82rem; color: var(--ink-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-family: 'Geist', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-dark); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--ink-muted); border: 1px solid var(--border); }
.btn--ghost:hover { color: var(--ink); border-color: var(--ink-muted); text-decoration: none; }
.btn--danger { background: transparent; color: #e03030; border: 1px solid rgba(224,48,48,0.3); }
.btn--danger:hover { background: #e03030; color: #fff; text-decoration: none; }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow); }
.card--link { cursor: pointer; }
.card--link::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 var(--radius) var(--radius);
  width: 0;
  transition: width 0.2s;
}
.card--link:hover::after { width: 100%; }

/* ── Domain badge ────────────────────────────────────────── */
.domain-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2em 0.6em;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  opacity: 0.85;
}

/* ── Article type badge ──────────────────────────────────── */
.type-badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.type-badge--concept     { background: rgba(26,110,181,0.1); color: #1a6eb5; }
.type-badge--procedure   { background: rgba(13,124,77,0.1);  color: #0d7c4d; }
.type-badge--troubleshoot{ background: rgba(227,0,48,0.08); color: var(--accent); }

/* ── Section label ───────────────────────────────────────── */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
}
.section-label::before {
  content: '';
  display: block;
  width: 16px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Hero search (home) ──────────────────────────────────── */
.hero {
  padding: 3.5rem 0 2.5rem;
  text-align: center;
}
.hero h1 { margin-bottom: 0.5rem; }
.hero p { font-size: 1.05rem; margin-bottom: 2rem; }
.hero-search {
  display: flex;
  align-items: center;
  max-width: 560px;
  margin: 0 auto 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 0.4rem 0.4rem 0.4rem 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.hero-search:focus-within { border-color: var(--accent); }
.hero-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: 'Geist', sans-serif;
  font-size: 1rem;
  outline: none;
}
.hero-search input::placeholder { color: var(--ink-faint); }
.hero-search button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 0.55rem 1.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.hero-search button:hover { background: var(--accent-dark); }

/* ── Domain grid ─────────────────────────────────────────── */
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}
.domain-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.domain-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.domain-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--color, var(--accent));
}
.domain-card__icon { font-size: 1.8rem; margin-bottom: 0.75rem; display: block; }
.domain-card__code {
  font-family: 'Geist Mono', monospace;
  font-size: 0.72rem;
  color: var(--color, var(--accent));
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.domain-card__name { font-family: 'Fraunces', serif; font-size: 1.1rem; font-weight: 300; color: var(--ink); margin-bottom: 0.4rem; }
.domain-card__desc { font-size: 0.83rem; color: var(--ink-muted); line-height: 1.5; }
.domain-card__count { font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.75rem; }

/* ── Article list ────────────────────────────────────────── */
.article-list { display: flex; flex-direction: column; gap: 0.75rem; }
.article-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s;
}
.article-item:hover { box-shadow: var(--shadow); text-decoration: none; }
.article-item__meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.25rem; }
.article-item__title { font-size: 0.95rem; font-weight: 500; color: var(--ink); line-height: 1.4; }
.article-item__excerpt { font-size: 0.83rem; color: var(--ink-muted); margin-top: 0.2rem; }
.article-item__right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; flex-shrink: 0; }
.article-item__views { font-size: 0.75rem; color: var(--ink-faint); white-space: nowrap; }

/* ── Article detail ──────────────────────────────────────── */
.article-header { padding: 2.5rem 0 1.5rem; }
.article-header__meta { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.article-content { padding-bottom: 3rem; }
.article-body { font-size: 0.97rem; line-height: 1.75; color: var(--ink-muted); }
.article-body h2, .article-body h3 { color: var(--ink); margin: 1.75rem 0 0.75rem; }
.article-body p { margin-bottom: 1rem; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-body li { margin-bottom: 0.3rem; }

/* Steps (procedure) */
.steps { display: flex; flex-direction: column; gap: 0; }
.step {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: none; }
.step__number {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Geist Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.step__title { font-weight: 500; color: var(--ink); margin-bottom: 0.5rem; font-size: 0.97rem; }
.step__content { color: var(--ink-muted); font-size: 0.9rem; line-height: 1.65; }
.step__notes {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(26,110,181,0.06);
  border-left: 3px solid #1a6eb5;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}
.step__notes::before { content: '💡 '; }
.step__screenshots { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; }
.step__screenshot { border-radius: var(--radius); border: 1px solid var(--border); max-width: 100%; cursor: zoom-in; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: 0.83rem; font-weight: 500; color: var(--ink); margin-bottom: 0.4rem; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: 'Geist', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 120px; }
.form-error { font-size: 0.8rem; color: #e03030; margin-top: 0.3rem; }
.form-help  { font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.3rem; }

/* ── Alert/Flash ──────────────────────────────────────────── */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 0.88rem; margin-bottom: 1rem; }
.alert--success { background: rgba(13,124,77,0.1); color: #0d7c4d; border: 1px solid rgba(13,124,77,0.2); }
.alert--error   { background: rgba(227,0,48,0.08); color: var(--accent); border: 1px solid rgba(227,0,48,0.2); }
.alert--info    { background: rgba(26,110,181,0.08); color: #1a6eb5; border: 1px solid rgba(26,110,181,0.2); }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-card__logo { text-align: center; margin-bottom: 2rem; }
.auth-card__logo-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: 'Geist Mono', monospace;
  font-size: 0.7rem;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}
.auth-card h2 { font-size: 1.4rem; margin-bottom: 0.25rem; }
.auth-card__sub { font-size: 0.85rem; color: var(--ink-muted); margin-bottom: 1.75rem; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th { text-align: left; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted); padding: 0.75rem 0.85rem; border-bottom: 2px solid var(--border); }
td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border); color: var(--ink); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-dim); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; gap: 0.4rem; justify-content: center; padding: 2rem 0; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--ink-muted);
  background: var(--surface);
  transition: all 0.15s;
  text-decoration: none;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Ask bar ─────────────────────────────────────────────── */
.ask-bar {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.ask-bar h3 { margin-bottom: 0.25rem; }
.ask-bar p  { font-size: 0.85rem; margin-bottom: 1rem; }
.ask-bar form { display: flex; gap: 0.75rem; }
.ask-bar input { flex: 1; }
.ask-bar .btn { flex-shrink: 0; }

/* ── AI answer box ───────────────────────────────────────── */
.ai-answer {
  background: rgba(26,110,181,0.05);
  border: 1px solid rgba(26,110,181,0.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  font-size: 0.92rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.ai-answer__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #1a6eb5;
}

/* ── Sidebar layout ──────────────────────────────────────── */
.layout-with-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: start;
  padding: 2rem 0 3rem;
}
.sidebar { position: sticky; top: 80px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.2rem; }
.sidebar-nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.87rem;
  color: var(--ink-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.sidebar-nav a:hover { background: var(--accent-dim); color: var(--ink); }
.sidebar-nav a.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }

[id] { scroll-margin-top: 80px; }

/* ── Status pill ─────────────────────────────────────────── */
.status-pill {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
}
.status-pill--published  { background: rgba(13,124,77,0.1);  color: #0d7c4d; }
.status-pill--pending    { background: rgba(227,0,48,0.08);  color: var(--accent); }
.status-pill--draft      { background: var(--accent-dim);   color: var(--ink-muted); }
.status-pill--ai_queued  { background: rgba(26,110,181,0.1); color: #1a6eb5; }
.status-pill--ai_answered{ background: rgba(13,124,77,0.1);  color: #0d7c4d; }
.status-pill--answered   { background: rgba(13,124,77,0.1);  color: #0d7c4d; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: var(--ink-faint);
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 860px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav__search { display: none; }
  .domain-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .domain-grid { grid-template-columns: 1fr; }
  .ask-bar form { flex-direction: column; }
  .nav__links { display: none; }
}
