/* TAK Self-Enrollment Portal — base styles.
 *
 * Every visual choice (color, font, radius, etc.) is a CSS custom property
 * declared on :root. A deployment that wants to skin the portal in their
 * own brand only needs to override those properties — no template edits.
 *
 * Where to override:
 *
 *   1. Drop a branding.css file into the SE assets directory. The
 *      template auto-loads it AFTER styles.css when the metadata field
 *      PORTAL_BRANDING_CSS is "true" (default). Anything redefined in
 *      branding.css wins by cascade order.
 *
 *   2. For one-off color tweaks without a separate file, set
 *      PORTAL_ACCENT_COLOR in the SE metadata block — the template
 *      injects it as an inline <style> overriding --accent.
 *
 *   3. For typography, override --font-stack via PORTAL_FONT_STACK
 *      metadata (e.g. "'Inter', system-ui, sans-serif").
 *
 *   4. For the page logo, set PORTAL_LOGO_URL metadata. The template
 *      renders an <img class="brand-logo"> in the header when this is
 *      non-empty.
 *
 * Branding branch: the future branding work lives ENTIRELY in branding.css
 * + logo image asset + a few metadata fields. No Go changes, no template
 * structural changes.
 */

:root {
  /* ── Brand colors (override these in branding.css to re-skin) ── */
  --accent:           #1f4ba8;
  --accent-hover:     #1a3d8a;
  --accent-soft-bg:   #f7faff;
  --accent-soft-bdr:  #b8d4ff;
  --accent-info-bg:   #f0f7ff;
  --secondary:        #888;
  --error:            #c0392b;
  --success:          #f7fff8;
  --success-bdr:      #b8e0c0;

  /* ── Surface / chrome ── */
  --bg-page:          #ffffff;
  --bg-code:          #f3f3f3;
  --text-primary:     #1a1a1a;
  --text-secondary:   #666666;
  --text-muted:       #888888;
  --text-on-accent:   #ffffff;
  --border-default:   #dddddd;

  /* ── Typography ── */
  --font-stack:       system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:        ui-monospace, "SF Mono", Menlo, monospace;
  --font-size-base:   1rem;
  --font-size-small:  0.9rem;
  --font-size-mono:   0.85rem;

  /* ── Spacing / shape ── */
  --radius-card:      0.5rem;
  --radius-button:    0.25rem;
  --page-max-width:   56rem;
  --page-margin-top:  3rem;
}

body {
  font-family: var(--font-stack);
  font-size: var(--font-size-base);
  max-width: var(--page-max-width);
  margin: var(--page-margin-top) auto;
  padding: 0 1.5rem;
  color: var(--text-primary);
  background: var(--bg-page);
}

h1 { margin-bottom: 0.25rem; }
.subtitle { color: var(--text-secondary); margin-top: 0; }
.intro { color: var(--text-secondary); margin: 0.5rem 0 1.5rem; max-width: 44rem; }
.intro strong { color: var(--text-primary); }

/* Discreet admin/operator link (e.g. the EmpowerNow console) — small, muted */
.admin-link { margin-top: 2.5rem; font-size: var(--font-size-small); text-align: right; }
.admin-link a { color: var(--text-muted); text-decoration: none; }
.admin-link a:hover { color: var(--accent); text-decoration: underline; }

/* Brand logo, optional — rendered by template when PORTAL_LOGO_URL is set */
.brand-logo {
  display: block;
  height: 2.5rem;
  margin-bottom: 1rem;
}

/* ─── Cards (landing) ─── */

.card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  margin: 1rem 0;
}
.card.sso { background: var(--accent-soft-bg); border-color: var(--accent-soft-bdr); }
.card.cac { background: var(--success); border-color: var(--success-bdr); }
.card.partner { background: var(--accent-soft-bg); border-color: var(--accent-soft-bdr); }

.button {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-button);
  text-decoration: none;
  font-weight: 500;
  margin-right: 0.5rem;
  border: none;
  cursor: pointer;
  font-size: var(--font-size-base);
}
.button:hover { background: var(--accent-hover); }
.button.secondary { background: var(--secondary); }

.note { color: var(--text-muted); font-size: var(--font-size-small); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; }
.dl dt { color: var(--text-secondary); font-weight: 500; }
.dl dd { margin: 0; font-family: var(--font-mono); }

/* ─── Enrollment page ─── */

.row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 1.5rem;
}
.qr-card { flex: 0 0 auto; text-align: center; }
.qr-wrap {
  display: inline-block;
  padding: 0.5rem;
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
}
.qr-wrap canvas {
  display: block;
  width: 320px;
  height: 320px;
}
.qr-caption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.qr-meta {
  margin-top: 0.5rem;
  font-size: var(--font-size-small);
  color: var(--text-secondary);
}
.qr-meta .ttl { font-weight: 600; color: var(--accent); }
.qr-meta .ttl.expired { color: var(--error); }

.qr-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
}
.qr-tab {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-button);
  cursor: pointer;
  background: var(--bg-page);
  font-size: 0.95rem;
}
.qr-tab.active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

/* min-width:0 lets this flex item shrink below the intrinsic width of a wide
   child (the debug-claims <pre>), so the <pre> scrolls (overflow-x:auto) instead
   of blowing the row past the container and forcing flex-wrap to a single column. */
.info-card { flex: 1 1 24rem; min-width: 0; }

pre {
  background: var(--bg-code);
  padding: 1rem;
  border-radius: var(--radius-card);
  overflow-x: auto;
  font-size: var(--font-size-mono);
  font-family: var(--font-mono);
}

.security {
  background: var(--accent-info-bg);
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: var(--font-size-small);
}
