/* ============================================================
   AIFactory Scalar Theme
   Maps the ai-factory-lp design system (Tailwind v4) onto the
   Scalar API Reference CSS variables.

   Style basis: C:\Entwicklung\RRZ.AIFactory\ai-factory-lp\src\styles
   Design tokens (theme.css / buttons.css / base.css):
     primary      #FAD600 (yellow, CTA/accent)
     body         #f1f1f1 (page background)
     text-default #1F2937
     dark         #000E30
     border-light #a3a3a3
     fonts: Satoshi (body), Syne (headings)
     buttons: pill (rounded-full), ring-4 hover ring, .35s ease

   Verified against @scalar/api-reference 1.66.1:
   - colors are driven by --scalar-* variables (light-mode/dark-mode)
   - ScalarButton solid variant uses .bg-b-btn (= --scalar-button-1)
   - try-it "Test Request" button uses .show-api-client-button
   - try-it send button uses [data-addressbar-action="send"]
   - code sample language pill uses .open-api-client-button
   - base radius: .rounded = --scalar-radius-md = min(--scalar-radius, max)
   ============================================================ */

@font-face {
  font-family: "Satoshi";
  src: url("../fonts/Satoshi-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Satoshi";
  src: url("../fonts/Satoshi-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Syne";
  src: url("../fonts/Syne-VariableFont_wght.ttf") format("truetype");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ai-factory design tokens */
  --af-primary: #fad600;
  --af-primary-hover-ring: rgba(250, 214, 0, 0.35);
  --af-secondary: #000000;
  --af-body: #f1f1f1;
  --af-border-light: #a3a3a3;
  --af-text-default: #1f2937;
  --af-dark: #000e30;

  /* Scalar typography + shape
     --scalar-radius drives ALL corner rounding (md/lg/xl are derived
     from it via min() in Scalar's :root), so one value restyles the
     whole reference. Pill look for controls is applied per-element. */
  --scalar-radius: 6px;
  --scalar-paragraph: 15px;
  --scalar-small: 13px;

  /* Fonts: Satoshi for text (withDefaultFonts: false in config).
     Code MUST be a real monospace stack — Satoshi has no monospace glyphs. */
  --scalar-font: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  --scalar-font-code: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

/* Scalar color palette — same in .light-mode and .dark-mode because the
   page is light-only (dark mode toggle disabled in api-config.json). */
.light-mode,
.dark-mode {
  --scalar-background-1: var(--af-body);
  --scalar-background-2: #ffffff;
  --scalar-background-3: #e4e8ee;
  --scalar-background-accent: rgba(250, 214, 0, 0.1);

  --scalar-color-1: var(--af-text-default);
  --scalar-color-2: rgba(31, 41, 55, 0.66);
  --scalar-color-3: rgba(31, 41, 55, 0.45);

  /* links + inline accents
     #766500 = darker yellow-brown; #b39900 on #f1f1f1 is ~2.6:1 (fails AA),
     #766500 reaches ~5.6:1 on #f1f1f1 and #ffffff. */
  --scalar-color-accent: #766500;
  --scalar-link-color: #766500;
  --scalar-link-color-hover: #5c5000;

  --scalar-border-color: rgba(163, 163, 163, 0.35);

  /* Solid buttons ("Test Request", CTAs): dark blue with yellow hover ring.
     (Yellow bg + #000E30 text fails contrast for white label text; the
     dark button keeps Scalar's white label readable while pill/ring keeps
     the ai-factory look. Yellow is used as the hover ring accent.) */
  --scalar-button-1: var(--af-dark);
  --scalar-button-1-hover: #001a52;
  --scalar-button-1-color: #ffffff;

  /* HTTP method colors — muted to match the flat ai-factory look */
  --scalar-color-green: #2f7d32;
  --scalar-color-red: #c62828;
  --scalar-color-yellow: #b39900;
  --scalar-color-blue: #1d4ed8;
  --scalar-color-orange: #c2570d;
  --scalar-color-purple: #6d28d9;
}

/* Sidebar — mirror main palette */
.light-mode .sidebar,
.dark-mode .sidebar {
  --scalar-sidebar-background-1: var(--af-body);
  --scalar-sidebar-item-hover-color: currentColor;
  --scalar-sidebar-item-hover-background: rgba(0, 14, 48, 0.06);
  --scalar-sidebar-item-active-background: rgba(250, 214, 0, 0.25);
  --scalar-sidebar-border-color: var(--scalar-border-color);
  --scalar-sidebar-color-1: var(--af-text-default);
  --scalar-sidebar-color-2: rgba(31, 41, 55, 0.6);
  --scalar-sidebar-color-active: var(--af-dark);
  --scalar-sidebar-search-background: #ffffff;
  --scalar-sidebar-search-border-color: var(--scalar-border-color);
  --scalar-sidebar-search-color: rgba(31, 41, 55, 0.45);
}

/* Page chrome */
html,
body {
  margin: 0;
  background-color: var(--af-body);
}

/* Page header stays visible while the reference scrolls.
   --scalar-custom-header-height is measured + set by load-reference.js so
   Scalar's sticky sidebar/cards offset below the header correctly. */
.af-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--af-body);
  border-bottom: 1px solid rgba(163, 163, 163, 0.35);
}

#app {
  min-height: calc(100dvh - var(--scalar-custom-header-height, 0px));
}

/* ai-factory scrollbar (base.css) */
* {
  scrollbar-width: thin;
}
*::-webkit-scrollbar {
  width: 12px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
}
*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::selection {
  background: var(--af-primary);
  color: var(--af-dark);
}

/* Keyboard focus visibility (WCAG 2.4.7) */
:focus-visible {
  outline: 3px solid var(--af-dark);
  outline-offset: 2px;
  border-radius: 4px;
}
.scalar-app :focus-visible,
.af-header :focus-visible {
  outline: 3px solid var(--af-dark);
  outline-offset: 2px;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------
   Pill buttons inside the Scalar reference.
   buttons.css look: rounded-full + ring-4 hover ring, .35s ease.
   These selectors target the real classes used by Scalar 1.66.
   ------------------------------------------------------------ */

/* "Test Request" pill on each operation */
.scalar-app .show-api-client-button {
  border-radius: 9999px;
  transition: box-shadow 0.35s ease-in-out;
}
.scalar-app .show-api-client-button:hover {
  box-shadow: 0 0 0 4px var(--af-primary-hover-ring);
}

/* Solid ScalarButtons (header CTAs, modal actions) */
.scalar-app .scalar-button-solid {
  border-radius: 9999px;
  transition: box-shadow 0.35s ease-in-out;
}
.scalar-app .scalar-button-solid:hover {
  box-shadow: 0 0 0 4px var(--af-primary-hover-ring);
}

/* Client library selector pill (code sample header) */
.scalar-app .open-api-client-button {
  border-radius: 9999px;
}

/* Try-it panel send button */
.scalar-app [data-addressbar-action="send"] {
  border-radius: 9999px;
  transition: box-shadow 0.35s ease-in-out;
}
.scalar-app [data-addressbar-action="send"]:hover {
  box-shadow: 0 0 0 4px var(--af-primary-hover-ring);
}

/* Header call-to-action area, if used */
.scalar-app .bg-b-header-cta {
  background-color: var(--af-primary);
  color: var(--af-dark);
  border-radius: 9999px;
}
.scalar-app .hover\:bg-h-header-cta:hover {
  background-color: var(--af-primary);
  box-shadow: 0 0 0 4px var(--af-primary-hover-ring);
}

/* ------------------------------------------------------------
   Hide Scalar's sidebar footer branding (bottom left):
   the "Powered by Scalar" link. No config flag exists in the
   CDN build, so remove the strip via CSS. Branding (RRZ logo)
   lives in the page header instead.
   ------------------------------------------------------------ */
.scalar-app .darklight-reference {
  display: none !important;
}

/* ------------------------------------------------------------
   Page header content — shared by index.html and admin.html.
   Mirrors ai-factory-lp: Syne headings, yellow CTA pill button.
   ------------------------------------------------------------ */
.af-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.af-header__logo {
  display: block;
  height: 40px;
  width: auto;
  object-fit: contain;
}

.af-header__title {
  font-family: "Syne", ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.01em;
  color: var(--af-text-default);
  margin: 0;
}

.af-header__title .af-accent {
  color: #b39900;
}

.af-header__subtitle {
  font-size: 13px;
  color: rgba(31, 41, 55, 0.6);
  margin: 2px 0 0;
}

/* Header navigation (page-level links + language toggle) */
.af-header__nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.af-header__link {
  font-family: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--af-text-default);
  text-decoration: none;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.35s ease-in-out, color 0.35s ease-in-out;
}

.af-header__link:hover {
  color: var(--af-dark);
  border-bottom-color: var(--af-primary);
}

/* Language toggle (DE | EN) — segmented pill in the page header */
.af-lang {
  display: inline-flex;
  border: 1px solid rgba(163, 163, 163, 0.5);
  border-radius: 9999px;
  padding: 3px;
  background: #ffffff;
  flex-shrink: 0;
}

.af-lang__btn {
  appearance: none;
  border: none;
  background: transparent;
  border-radius: 9999px;
  padding: 6px 18px;
  font-family: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(31, 41, 55, 0.6);
  cursor: pointer;
  transition: background 0.35s ease-in-out, color 0.35s ease-in-out,
    box-shadow 0.35s ease-in-out;
}

.af-lang__btn:hover {
  color: var(--af-dark);
  box-shadow: 0 0 0 3px var(--af-primary-hover-ring);
}

.af-lang__btn[aria-pressed="true"] {
  background: var(--af-dark);
  color: #ffffff;
}

.af-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 9999px;
  padding: 8px 28px;
  font-family: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--af-dark);
  background: var(--af-primary);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.35s ease-in-out;
}

.af-btn:hover {
  box-shadow: 0 0 0 4px var(--af-primary-hover-ring);
}

.af-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.af-btn--ghost {
  background: #ffffff;
  color: var(--af-text-default);
  border: 1px solid rgba(163, 163, 163, 0.5);
}

.af-btn--ghost:hover {
  box-shadow: 0 0 0 4px rgba(0, 14, 48, 0.08);
}

/* Loading / error state banner */
.af-status {
  max-width: 860px;
  margin: 48px auto;
  padding: 24px 28px;
  background: #ffffff;
  border: 1px solid rgba(163, 163, 163, 0.35);
  border-radius: 14px;
  font-family: "Satoshi", ui-sans-serif, system-ui, sans-serif;
  color: var(--af-text-default);
  font-size: 15px;
  line-height: 1.8;
}

.af-status--error {
  border-color: #c62828;
  background: #fdf2f1;
}

.af-status h2 {
  font-family: "Syne", ui-sans-serif, system-ui, sans-serif;
  font-weight: 500;
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--af-text-default);
}

.af-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 14, 48, 0.15);
  border-top-color: var(--af-primary);
  border-radius: 50%;
  animation: af-spin 0.8s linear infinite;
  vertical-align: -4px;
  margin-right: 10px;
}

@keyframes af-spin {
  to {
    transform: rotate(360deg);
  }
}
