/* ===== SAP MM Academy — Shared Stylesheet ===== */

:root {
  color-scheme: light dark;
  /* ===== SAP Fiori-inspired palette ===== */
  --bg: #ffffff;
  --bg-soft: #f5f6f7;        /* Fiori grey background */
  --bg-card: #ffffff;
  --text: #32363a;           /* Fiori text grey */
  --text-soft: #4a4e51;
  --muted: #6a6d70;
  --border: #d9dce0;
  --accent: #0a6ed1;         /* SAP Belize blue */
  --accent-soft: #d6e8fb;
  --primary: #0a6ed1;
  --good: #107e3e;           /* SAP green */
  --warn: #e9730c;           /* SAP orange */
  --bad: #bb0000;            /* SAP red */
  --code-bg: #eef1f4;
  --sap-gold: #f0ab00;       /* SAP gold accent */
  --sap-shell: #354a5f;      /* SAP shell-bar dark blue */
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --radius: 10px;
  --radius-lg: 14px;
  --font: "72", "72full", -apple-system, "Segoe UI", Arial, Helvetica, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171c;
    --bg-soft: #1b2127;
    --bg-card: #1b2127;
    --text: #e5e7e9;
    --text-soft: #c4c7ca;
    --muted: #9a9da1;
    --border: #333a42;
    --accent: #66b3ff;
    --accent-soft: rgba(10,110,209,.22);
    --code-bg: #262d34;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  margin: 0;
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout containers ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 800px; margin: 0 auto; padding: 0 1.25rem; }
.container-wide { max-width: 1400px; margin: 0 auto; padding: 0 1.25rem; }

/* ===== Header / Navigation ===== */
.site-header {
  background: var(--sap-shell);
  border-bottom: 1px solid rgba(0,0,0,.25);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.site-header .nav-inner {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .85rem 1.25rem; max-width: 1400px; margin: 0 auto;
}
.site-header .logo {
  font-weight: 800; font-size: 1.1rem; color: #fff;
  text-decoration: none; display: flex; align-items: center; gap: .35rem;
}
.site-header .logo .pill {
  background: var(--sap-gold); color: #2b2b2b; font-size: .65rem;
  padding: 2px 7px; border-radius: 8px; font-weight: 700;
}
.site-header nav { display: flex; gap: .5rem; flex-wrap: wrap; }
.site-header nav a {
  color: rgba(255,255,255,.85); text-decoration: none;
  font-size: .92rem; padding: .35rem .6rem; border-radius: 6px;
  transition: background .15s, color .15s;
}
.site-header nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.site-header nav a.active { color: #ffc933; font-weight: 700; }
@media (max-width: 720px) {
  .site-header .nav-inner { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .site-header nav { font-size: .85rem; }
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
  font-size: .82rem; color: var(--muted);
  padding: .75rem 0; display: flex; gap: .35rem; flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span.sep { opacity: .5; }

/* ===== Hero ===== */
.hero {
  padding: 4rem 1.25rem 3rem;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15; margin: 0 0 1rem; letter-spacing: -.02em;
}
.hero p.lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-soft); max-width: 720px;
  margin: 0 auto 1.5rem; line-height: 1.6;
}
.hero .cta {
  display: inline-flex; gap: .75rem; flex-wrap: wrap; justify-content: center;
}
.btn {
  display: inline-block; padding: .65rem 1.25rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 600; text-decoration: none; font-size: .95rem;
  cursor: pointer; background: var(--bg-card); color: var(--text);
  transition: transform .1s, box-shadow .15s;
}
.btn:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover { background: #085caf; }

/* ===== Page content ===== */
main { padding: 1.5rem 0 3rem; }
section { margin: 2rem 0; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 2rem; margin: 0 0 .5rem; }
h2 {
  font-size: 1.45rem; margin: 2.5rem 0 .75rem;
  padding-bottom: .35rem; border-bottom: 2px solid var(--border);
  color: var(--accent); scroll-margin-top: 5rem;
}
h3 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h4 { font-size: 1rem; margin: 1rem 0 .35rem; color: var(--muted); }
p { margin: .5rem 0 .75rem; color: var(--text-soft); }
a { color: var(--accent); }

/* ===== TOC ===== */
.toc {
  background: var(--bg-soft); padding: 1rem 1.25rem;
  border-radius: var(--radius); margin: 1.5rem 0;
  border-left: 4px solid var(--accent); font-size: .92rem;
}
.toc h3 {
  margin: 0 0 .35rem; font-size: .75rem;
  text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
}
.toc ol { margin: .25rem 0; padding-left: 1.5rem; }
.toc li { margin: .15rem 0; color: var(--text-soft); }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ===== Cards ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
  margin: 1rem 0;
}
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.card .card-title { font-weight: 700; margin: 0 0 .35rem; }
.card .card-meta { font-size: .82rem; color: var(--muted); }

.feature-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow); text-align: left;
  transition: transform .15s, box-shadow .15s;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.feature-card .icon { font-size: 1.8rem; margin-bottom: .5rem; }
.feature-card h3 { margin: 0 0 .35rem; font-size: 1.1rem; }
.feature-card p { color: var(--muted); font-size: .9rem; margin: 0; }
.feature-card a { display: inline-block; margin-top: .65rem;
                  color: var(--accent); font-weight: 600; text-decoration: none; font-size: .9rem; }
.feature-card a:hover { text-decoration: underline; }

/* ===== Tables ===== */
table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: .92rem; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
th {
  background: var(--bg-soft); padding: .55rem .8rem; text-align: left;
  font-weight: 600; font-size: .85rem;
  border-bottom: 1px solid var(--border);
}
td { padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-soft); }

/* ===== Callouts ===== */
.callout {
  padding: 1rem 1.2rem; margin: 1.25rem 0;
  border-left: 4px solid; border-radius: var(--radius);
  background: var(--bg-soft); font-size: .95rem;
}
.callout .callout-title { font-weight: 700; margin-bottom: .25rem; }
.callout.info { border-color: var(--accent); background: rgba(37,99,235,.06); }
.callout.warn { border-color: var(--warn); background: rgba(245,158,11,.08); }
.callout.bad  { border-color: var(--bad);  background: rgba(239,68,68,.08); }
.callout.key  { border-color: var(--good); background: linear-gradient(135deg, rgba(16,185,129,.1), rgba(16,185,129,.03)); }
.callout.key b { color: var(--good); }
.callout.tip  { border-color: #8b5cf6; background: rgba(139,92,246,.08); }

/* ===== Code & T-codes ===== */
code, .tcode {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--code-bg); padding: 1px 6px; border-radius: 4px;
}
.tcode { color: var(--accent); font-weight: 600; }
pre {
  background: var(--bg-soft); padding: 1rem 1.25rem;
  border-radius: var(--radius); overflow-x: auto;
  font-size: .85rem; line-height: 1.55;
  border-left: 4px solid var(--muted);
}
pre code { background: transparent; padding: 0; }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: .72rem; font-weight: 700; vertical-align: middle; color: #fff;
}
.badge.req { background: var(--bad); }
.badge.opt { background: var(--muted); }
.badge.rec { background: var(--good); }

/* ===== Step list ===== */
.steps { counter-reset: step; padding: 0; list-style: none; }
.steps li {
  position: relative; padding: 1rem 1rem 1rem 3.5rem;
  margin: .75rem 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 1rem; top: 1rem;
  width: 1.8rem; height: 1.8rem;
  background: var(--accent); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.steps li b { display: block; margin-bottom: .25rem; }

/* ===== Footer ===== */
.site-footer {
  margin-top: 4rem; padding: 2rem 0 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: .9rem; color: var(--muted);
}
.site-footer .footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 1.25rem;
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 1.5rem;
}
@media (max-width: 760px) { .site-footer .footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .site-footer .footer-inner { grid-template-columns: 1fr; } }
.site-footer h4 { margin: 0 0 .5rem; color: var(--text); font-size: .95rem; }
.site-footer a { color: var(--muted); text-decoration: none; display: block; padding: .15rem 0; }
.site-footer a:hover { color: var(--accent); }
.site-footer .copy { text-align: center; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--border); font-size: .85rem; }

/* ===== Memory hook (highlight) ===== */
.memory-hook {
  margin: 1.5rem 0; padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(250,204,21,.18), rgba(250,204,21,.04));
  border-left: 4px solid #facc15; border-radius: var(--radius);
  font-size: 1rem;
}
.memory-hook::before { content: "🧠 "; }
.memory-hook b { color: #b45309; }
@media (prefers-color-scheme: dark) {
  .memory-hook b { color: #fbbf24; }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.small { font-size: .85rem; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }

/* ===== FAQ ===== */
.faq details {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem 1rem; margin: .5rem 0;
}
.faq summary { cursor: pointer; font-weight: 600; color: var(--text); }
.faq details[open] { box-shadow: var(--shadow); }
.faq details p { margin: .5rem 0 0; color: var(--text-soft); }

/* ===== Responsive / Mobile ===== */
/* Safety net: no element may force a horizontal page-scroll */
img, svg, pre, table, iframe { max-width: 100%; }

@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .container, .container-narrow, .container-wide { padding: 0 1rem; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.05rem; }

  /* Wide data tables: scroll INSIDE their own box instead of overflowing the page.
     A faint right-edge shadow hints there is more to swipe. */
  main table {
    display: block; width: 100%; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background:
      linear-gradient(to right, var(--bg-card) 30%, rgba(0,0,0,0)),
      linear-gradient(to right, rgba(0,0,0,0), var(--bg-card) 70%) 100% 0,
      radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.12), rgba(0,0,0,0)),
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.12), rgba(0,0,0,0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 28px 100%, 28px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  main table th, main table td { white-space: normal; }

  /* Long codes / account numbers wrap instead of pushing the layout wider */
  code, .tcode, .acct-num { overflow-wrap: anywhere; word-break: break-word; }

  /* Sticky header is short on phones — keep section anchors clear of it */
  h2, h3 { scroll-margin-top: 4rem; }
}

@media (max-width: 420px) {
  .hero { padding: 2.5rem 1rem 2rem; }
  .container, .container-narrow, .container-wide { padding: 0 .85rem; }
}

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .breadcrumb { display: none; }
  body { font-size: 11pt; }
  main { padding: 0; }
}
