/* ============================================================================
   cufemlab SaaS dashboard -- SaaS-W6 frontend stylesheet
   Copyright (c) 2026 Secrotec B.V.  All Rights Reserved.
   PROPRIETARY -- see LICENSE.

   Extends the public site design system. Retheme W7: light professional
   palette mirrored verbatim from website/assets/css/cufemlab.css so the
   self-serve app at /app matches the marketing site everywhere.
   ============================================================================ */

/* ---- Tokens (mirrored from website/assets/css/cufemlab.css) --------------
   Light neutral palette + one restrained corporate blue accent. The whole
   app is driven by these variables, so this block is the single source of
   truth for the app theme. ------------------------------------------------- */
:root {
  --bg-0:     #f5f7fa;   /* app canvas (page background) */
  --bg-1:     #ffffff;   /* cards / panels / sticky header */
  --bg-2:     #eef1f6;   /* sunken: inputs, progress tracks, chips */
  --bg-3:     #e3e8f0;   /* deeper sunken */
  --border:   #dfe4ec;
  --border-strong: #c8d0dc;

  --fg-1:     #0f2034;   /* ink / headings */
  --fg-2:     #33425a;   /* body text */
  --fg-3:     #677488;   /* muted */

  --accent:        #0b5fb0;   /* corporate brand blue */
  --accent-hover:  #0a4d90;
  --accent-2:      #0a4d90;
  --accent-3:      #9a6a10;

  --pass:    #1d7a3e;
  --partial: #9a6a10;
  --fail:    #b42318;
  --info:    #0b5fb0;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
               Menlo, Consolas, "Liberation Mono", monospace;

  --maxw-page:    1280px;
  --maxw-content: 880px;
  --radius:       10px;
  --radius-lg:    14px;

  --t-fast: 120ms;
  --t-med:  220ms;
  --ease:   cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

/* scrollbar-gutter: stable -> reserve the scrollbar track on every page so the
   centered .container never shifts right when navigating to a short page. */
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg-2);
  background:
    radial-gradient(ellipse at top, rgba(11,95,176,0.04) 0%, transparent 55%),
    var(--bg-0);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.2; color: var(--fg-1); margin: 0 0 0.6em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; color: var(--fg-2); }

code, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--fg-3); }

/* ---- Layout primitives --------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw-page); margin: 0 auto; padding: 0 24px; }
.section { padding: 32px 0; }

/* ---- Navigation bar (matches website style) ------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--fg-1); font-weight: 700; font-size: 1.05rem;
}
.brand-name span { color: var(--accent); }
.brand-tag {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-3);
  padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px;
}

.nav-links { display: flex; gap: 22px; list-style: none; padding: 0; margin: 0; align-items: center; }
.nav-links a { color: var(--fg-2); font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover { color: var(--fg-1); }
.nav-links a.active { color: var(--accent); }
.nav-links a.cta {
  background: var(--accent); color: var(--bg-0); padding: 7px 14px;
  border-radius: 6px; font-weight: 600;
}
.nav-links a.cta:hover { background: var(--accent-hover); color: var(--bg-0); }
.nav-links a.ghost {
  border: 1px solid var(--border-strong); color: var(--fg-1); padding: 7px 14px;
  border-radius: 8px; font-weight: 600;
}
.nav-links a.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Public-facing header (login / index.html) — pixel-mirror the marketing
   site nav so it does not shift/restyle when navigating between the two.
   Scoped to .public-header so the logged-in app nav (13 dense items) is
   untouched. Values copied verbatim from website/assets/css/main.css. */
.public-header .logo-svg { width: 28px; height: 28px; display: block; }
.public-header .nav-links { gap: 28px; }
.public-header .nav-links a { font-size: 14px; }
.public-header .nav-links a.cta { padding: 8px 16px; border-radius: 8px; }
.public-header .brand-tag { font-size: 11px; }
.public-header .brand-name { font-size: 18px; }
.public-header .brand { gap: 10px; }

@media (max-width: 720px) {
  .nav-links { gap: 12px; flex-wrap: wrap; }
}

/* ---- Buttons (mirrors website) ------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; font-weight: 600; font-size: 0.92rem;
  padding: 10px 18px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: var(--bg-0); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent; color: var(--fg-1); border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-2); }
.btn-danger { background: #fdeceb; color: var(--fail); border-color: #f3c9c5; }
.btn-danger:hover { background: #fbdcd9; }
/* Ghost / low-emphasis button (used in jupyter + admin toolbars). Was never
   defined, so it fell back to bare .btn and inherited text color — now an
   explicit light-theme style. */
.btn-ghost { background: transparent; color: var(--fg-2); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-2); color: var(--accent); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Card --------------------------------------------------------------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 1px 2px rgba(16,32,52,.06), 0 1px 1px rgba(16,32,52,.04);
  transition: border-color var(--t-fast) var(--ease);
}
.card:hover { border-color: var(--border-strong); }
.card-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ---- Stat cards --------------------------------------------------------- */
.stat-card .stat-v {
  display: block; font-family: var(--font-mono);
  font-size: 1.8rem; color: var(--accent); margin-bottom: 4px;
}
.stat-card .stat-l { color: var(--fg-3); font-size: 0.85rem; }

/* ---- Verdict badges ----------------------------------------------------- */
.verdict {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
}
.verdict.pass     { background: #e8f5ec; color: var(--pass); border: 1px solid #bfe3cd; }
.verdict.partial  { background: #fbf4e6; color: var(--partial); border: 1px solid #f0dcae; }
.verdict.fail     { background: #fdeceb; color: var(--fail); border: 1px solid #f3c9c5; }
.verdict.gpu      { background: #eaf2fb; color: var(--accent); border: 1px solid #cfe0f4; }
.verdict.notimpl  { background: #f1f3f7; color: var(--fg-3); border: 1px solid var(--border); }
.verdict.cancelled { background: #fdeceb; color: var(--fail); border: 1px solid #f3c9c5; }
.verdict.paused    { background: #eaf2fb; color: var(--accent); border: 1px solid #cfe0f4; }

/* ---- Tables ------------------------------------------------------------- */
table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem; margin: 18px 0;
}
thead th {
  text-align: left; color: var(--fg-3); font-weight: 600;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 12px; border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px; border-bottom: 1px solid var(--border);
  color: var(--fg-2);
}
tbody tr:hover { background: rgba(15,32,52,0.03); }
tbody tr.highlight { background: var(--bg-2); }

/* ---- Forms -------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 0.85rem; color: var(--fg-2);
  margin-bottom: 6px; font-weight: 500;
}
.form-input, .form-select, .form-textarea {
  width: 100%; background: var(--bg-2); color: var(--fg-1);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-family: inherit; font-size: 0.92rem;
  transition: border-color var(--t-fast) var(--ease);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-help { color: var(--fg-3); font-size: 0.8rem; margin-top: 4px; }

/* ---- Alert / error envelope -------------------------------------------- */
.alert {
  padding: 12px 16px; border-radius: 8px; margin: 14px 0;
  font-size: 0.9rem; border: 1px solid;
}
.alert-error   { background: #fdeceb; border-color: #f3c9c5; color: var(--fail); }
.alert-warning { background: #fbf4e6; border-color: #f0dcae; color: var(--partial); }
.alert-success { background: #e8f5ec; border-color: #bfe3cd; color: var(--pass); }
.alert-info    { background: #eaf2fb; border-color: #cfe0f4; color: var(--accent); }

/* ---- Modal -------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,32,52,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--bg-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: 26px;
  max-width: 520px; width: 90%;
}
.modal h3 { margin-top: 0; }

/* ---- App page header ---------------------------------------------------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 0 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { margin: 0; }

/* ---- Auth pages --------------------------------------------------------- */
.auth-wrap {
  min-height: calc(100vh - 70px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1; background: transparent; border: none;
  color: var(--fg-3); padding: 12px; cursor: pointer;
  font-family: inherit; font-size: 0.92rem; font-weight: 500;
  border-bottom: 2px solid transparent;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- Footer / utility --------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; margin-top: 60px;
  color: var(--fg-3); font-size: 0.82rem;
}

.progress-bar {
  height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden;
}
.progress-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--t-med) var(--ease);
}

/* Live Monitor (phase 5.5) — generic horizontal meter. Color comes from inline style. */
.progress {
  height: 10px; background: var(--bg-2); border-radius: 999px;
  overflow: hidden; margin-top: 4px;
}
.progress-fill {
  height: 100%; transition: width 400ms var(--ease);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.copy-button {
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 4px 10px; background: var(--bg-2); border: 1px solid var(--border);
  color: var(--fg-2); border-radius: 6px; cursor: pointer;
}
.copy-button:hover { color: var(--accent); border-color: var(--accent); }

.key-display {
  font-family: var(--font-mono); background: var(--bg-2);
  padding: 12px; border-radius: 8px; border: 1px solid var(--border);
  word-break: break-all; color: var(--accent);
  margin: 10px 0;
}

[x-cloak] { display: none !important; }
