/*
 * platform.css — HFIV3 Ads Portal shared design tokens
 * Aesthetic: editorial, calm, minimal chrome.
 * The ad imagery carries the visual weight; the UI stays quiet.
 *
 * Usage: <link rel="stylesheet" href="/_platform/platform.css">
 *
 * Google Fonts required in the page <head> (already in this file via @import):
 *   Instrument Sans 400/500/600 — body + UI
 *   DM Mono 400/500            — labels, codes, scores
 *
 * Token reference:
 *   --p-bg          warm cream background (#f1f0ee)
 *   --p-fg          near-black foreground (#1d1d1d)
 *   --p-card        white card surface (#ffffff)
 *   --p-muted       soft warm grey (#e8e6e3)
 *   --p-muted-fg    muted text (#6b6966)
 *   --p-accent      neutral foreground alias (pure b/w — no terracotta)
 *   --p-border      subtle warm border (#d9d7d4)
 *   --p-radius      base border-radius (4px)
 *
 * Utility classes:
 *   .platform-page      — full-page layout (cream bg, centered)
 *   .platform-card      — white card with border + subtle shadow
 *   .platform-label     — mono uppercase label (small caps style)
 *   .platform-input     — text / number input field
 *   .platform-textarea  — multiline textarea
 *   .platform-button    — primary filled button (near-black)
 *   .platform-button-ghost — ghost/outline button
 *   .platform-divider   — 1px warm horizontal rule
 */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ===== Tokens ===== */
:root {
  --p-bg:        #f1f0ee;
  --p-fg:        #1d1d1d;
  --p-card:      #ffffff;
  --p-muted:     #e8e6e3;
  --p-muted-fg:  #6b6966;
  --p-accent:    #1d1d1d; /* was terracotta #c4653a — pure b/w, equals --p-fg */
  --p-border:    #d9d7d4;
  --p-radius:    4px;

  /* semantic aliases */
  --p-font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif;
  --p-font-mono: 'DM Mono', ui-monospace, monospace;
}

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

/* ===== Base ===== */

/*
 * .platform-page
 * Full-viewport page wrapper. Applies background, foreground and font.
 * Add to <body> or a top-level wrapper.
 */
.platform-page {
  background: var(--p-bg);
  color: var(--p-fg);
  font-family: var(--p-font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/*
 * .platform-card
 * White surface card on the cream background.
 * Subtle 1px border + soft box-shadow to lift it without drama.
 */
.platform-card {
  background: var(--p-card);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  box-shadow: 0 1px 3px rgba(29, 29, 29, 0.06);
  overflow: hidden;
}

/*
 * .platform-label
 * Mono uppercase micro-label. Used for field labels, metadata tags,
 * eyebrows, and badge text.
 */
.platform-label {
  font-family: var(--p-font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--p-muted-fg);
  display: block;
}

/*
 * .platform-input
 * Single-line text / email / number input.
 * Cream bg, warm border, near-black focus ring.
 */
.platform-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  color: var(--p-fg);
  font-family: var(--p-font-sans);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}

.platform-input:focus {
  border-color: var(--p-fg);
}

.platform-input::placeholder {
  color: var(--p-muted-fg);
}

/*
 * .platform-textarea
 * Multiline textarea. Same tokens as .platform-input.
 */
.platform-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  color: var(--p-fg);
  font-family: var(--p-font-sans);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  min-height: 72px;
}

.platform-textarea:focus {
  border-color: var(--p-fg);
}

.platform-textarea::placeholder {
  color: var(--p-muted-fg);
}

/*
 * .platform-button
 * Primary filled action button. Background: near-black.
 */
.platform-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--p-fg);
  color: #ffffff;
  border: 1px solid var(--p-fg);
  border-radius: var(--p-radius);
  font-family: var(--p-font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.platform-button:hover {
  opacity: 0.88;
}

.platform-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/*
 * .platform-button-ghost
 * Ghost / outline button. No fill, warm border, near-black on hover.
 */
.platform-button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: transparent;
  color: var(--p-fg);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  font-family: var(--p-font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
}

.platform-button-ghost:hover {
  border-color: var(--p-fg);
}

/*
 * .platform-divider
 * 1px warm horizontal rule.
 */
.platform-divider {
  border: none;
  border-top: 1px solid var(--p-border);
  margin: 0;
}

/* ===== Extended tokens for brand-dashboards =====
 *
 * The core tokens above cover ad-review portals. Brand-dashboards (BIC and
 * future ones) need a slightly richer set: a secondary card tone, a "soft"
 * background for nested panels, and stronger / fainter ink + border shades
 * for hover states, dividers and meta-text.
 *
 * These mirror the variable names that the (originally dark-mode) BIC chrome
 * relied on (`--bg-soft`, `--card-2`, `--ink-soft`, `--ink-faint`,
 * `--border-strong`), so any new brand dashboard can adopt the warm-editorial
 * look with a one-block var-remap inside its <style> tag — same pattern as
 * `ads-portal/public/superbrand/index.html`.
 *
 * Token reference:
 *   --p-bg-soft        nested-panel background (#e8e6e3, equals --p-muted)
 *   --p-card-2         hover/secondary card surface (#f7f6f4)
 *   --p-ink-soft       secondary text (#4a4744)
 *   --p-ink-faint      tertiary / hint text (#a8a4a0)
 *   --p-border-strong  hover/active border, still warm (#b8b4b0)
 *   --p-success        muted green for status badges (#2f7d4f)
 *   --p-success-bg     tinted green background (rgba based on --p-success)
 *   --p-danger         muted red for warnings (#c0392b)
 */
:root {
  --p-bg-soft:       #e8e6e3;
  --p-card-2:        #f7f6f4;
  --p-ink-soft:      #4a4744;
  --p-ink-faint:     #a8a4a0;
  --p-border-strong: #b8b4b0;
  --p-success:       #2f7d4f;
  --p-success-bg:    rgba(47, 125, 79, 0.08);
  --p-danger:        #c0392b;
}

/* ===== Minimal topbar chrome (BUILD-636) =====
 *
 * Shared topbar pattern for HFIV3 dashboards. Mirrors the topbar that ships
 * on `mailings.hfiv3.com/admin`: three elements only — app-switcher pill on
 * the left, brand label centre-left, logout link on the right. The topbar
 * itself is a low-key 1px-bottom-border strip on the cream surface — no
 * shadow, no titles. Per-dashboard chrome (tabs, filters, content) lives
 * below the topbar inside <main>.
 *
 * Usage (see public/bic/index.html for the canonical example):
 *
 *   <header class="platform-topbar">
 *     <div class="platform-topbar-left">
 *       <div class="platform-app-switcher" data-current="dashboard">
 *         <button class="platform-app-switcher-btn" type="button"
 *                 aria-haspopup="listbox" aria-expanded="false">
 *           <span class="platform-app-switcher-label">DASHBOARD</span>
 *           <span class="platform-app-switcher-chev" aria-hidden="true">▼</span>
 *         </button>
 *         <ul class="platform-app-switcher-menu" role="listbox" hidden></ul>
 *       </div>
 *       <span class="platform-topbar-brand" data-brand="superbrand">Superbrand</span>
 *     </div>
 *     <div class="platform-topbar-right">
 *       <a class="platform-topbar-link" href="/logout">Uitloggen</a>
 *     </div>
 *   </header>
 *
 * The app-switcher menu items are rendered via DOM APIs (createElement +
 * textContent) — no innerHTML — same XSS-safety convention as BUILD-633.
 */
.platform-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 28px;
  background: var(--p-bg);
  border-bottom: 1px solid var(--p-border);
  font-family: var(--p-font-sans);
}

.platform-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.platform-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.platform-topbar-brand {
  font-family: var(--p-font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--p-fg);
  letter-spacing: 0;
  white-space: nowrap;
}

.platform-topbar-link {
  font-family: var(--p-font-sans);
  font-size: 13px;
  color: var(--p-muted-fg);
  text-decoration: none;
  transition: color 0.15s;
}

.platform-topbar-link:hover {
  color: var(--p-fg);
}

/* ----- App switcher pill ----- */

.platform-app-switcher {
  position: relative;
  font-family: var(--p-font-mono);
}

.platform-app-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--p-muted);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  color: var(--p-fg);
  font-family: var(--p-font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.platform-app-switcher-btn:hover,
.platform-app-switcher-btn[aria-expanded="true"] {
  border-color: var(--p-border-strong);
}

.platform-app-switcher-label {
  line-height: 1;
}

.platform-app-switcher-chev {
  font-size: 8px;
  line-height: 1;
  color: var(--p-muted-fg);
  transform: translateY(1px);
}

.platform-app-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  margin: 0;
  padding: 4px;
  min-width: 160px;
  list-style: none;
  background: var(--p-card);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  box-shadow: 0 4px 12px rgba(29, 29, 29, 0.08);
  z-index: 100;
}

.platform-app-switcher-menu[hidden] {
  display: none;
}

.platform-app-switcher-menu li {
  margin: 0;
}

.platform-app-switcher-item {
  display: block;
  padding: 7px 12px;
  font-family: var(--p-font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-fg);
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.12s;
}

.platform-app-switcher-item:hover {
  background: var(--p-muted);
}

.platform-app-switcher-item.is-current {
  background: var(--p-muted);
  color: var(--p-fg);
  cursor: default;
}

@media (max-width: 720px) {
  .platform-topbar { padding: 10px 14px; }
  .platform-topbar-brand { font-size: 14px; }
  .platform-app-switcher-btn { padding: 6px 10px; font-size: 9px; }
}
