/* ============================================================
   SYMBINARY v2 – Design System (concept chapter O)
   Navy/blue trust aesthetic · light + dark mode
   ============================================================ */

:root {
  --brand-900: #0B1B3A;
  --brand-700: #12295C;
  --brand-600: #1E5BFF;
  --brand-500: #3D74FF;
  --brand-300: #7FA8FF;
  --success:   #12B76A;
  --warn:      #F79009;
  --danger:    #F04438;
  --danger-dark: #B42318;

  --bg:        #F7F9FC;
  --surface:   #FFFFFF;
  --surface-2: #EEF2F8;
  --text:      #0B1B3A;
  --text-2:    #5A6B8C;
  --border:    #DDE4F0;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 4px 24px rgba(11, 27, 58, .07);
  --font:      'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Configurable branding (overridden inline from admin settings) */
  --topbar-bg: var(--brand-900);
  --topbar-fg: #C6D4F2;
  --footer-bg: var(--brand-900);
  --footer-fg: #C6D4F2;
  --logo-scale: 100;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0A0F1C;
    --surface:   #111A2E;
    --surface-2: #1A2540;
    --text:      #EAF0FA;
    --text-2:    #8FA0C0;
    --border:    #24304D;
    --shadow:    0 4px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;   /* sticky footer: content grows, footer stays bottom */
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;            /* many admin items: wrap instead of clipping */
  gap: 8px 18px;
  min-height: 60px;           /* grows with a second row – never cuts items off */
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .logo { font-weight: 800; font-size: calc(19px * var(--logo-scale) / 100); letter-spacing: .04em; color: var(--topbar-fg); white-space: nowrap; }
.topbar .logo span { color: var(--brand-300); }
.topbar .logo img { height: calc(34px * var(--logo-scale) / 100); display: block; width: auto; }
.topbar nav { display: flex; gap: 4px; flex: 1 1 auto; flex-wrap: wrap; min-width: 0; }
.topbar nav a {
  color: var(--topbar-fg); opacity: .85; padding: 7px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.topbar nav a:hover, .topbar nav a.active { background: rgba(127,168,255,.18); opacity: 1; text-decoration: none; }
.topbar .user { color: var(--topbar-fg); opacity: .9; font-size: 13px; white-space: nowrap; }

/* Right cluster: language switch + user, top-right, compact */
.topbar .right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 6px 10px; }
  .topbar nav { order: 3; flex-basis: 100%; }   /* menu gets its own full row on phones */
}

/* ── Language switcher (compact) ─────────────────────────── */
.lang-switch {
  font-size: 12.5px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  max-width: 130px; cursor: pointer;
}
.lang-switch.on-dark {
  background: rgba(255,255,255,.1); color: var(--topbar-fg);
  border-color: rgba(255,255,255,.25);
}

/* ── Site footer (everywhere) ────────────────────────────── */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-fg);
  padding: 13px 20px;
  margin-top: auto;          /* pushes footer to the very bottom on short pages */
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap; font-size: 12.5px;
}
.site-footer .foot-logo {
  color: var(--footer-fg); font-weight: 800; letter-spacing: .04em; text-decoration: none;
  display: inline-flex; align-items: center;
}
.site-footer .foot-logo span { color: var(--brand-300); }
.site-footer .foot-logo img { height: calc(22px * var(--logo-scale) / 100); display: block; width: auto; }
.site-footer .foot-meta { opacity: .85; }
.site-footer a:hover { text-decoration: underline; }

/* width:100% is required so the flex-column body doesn't shrink-wrap .wrap */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.page-title { font-size: 26px; font-weight: 750; margin-bottom: 4px; }
.page-sub { color: var(--text-2); font-size: 14px; margin-bottom: 26px; }

/* ── Cards / grid ───────────────────────────────────────── */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card h2 { font-size: 16px; font-weight: 650; margin-bottom: 14px; }
.stat .num { font-size: 30px; font-weight: 800; }
.stat .lbl { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--text-2); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.badge.green  { background: rgba(18,183,106,.14); color: var(--success); }
.badge.yellow { background: rgba(247,144,9,.14);  color: var(--warn); }
.badge.orange { background: rgba(247,144,9,.22);  color: #D96C00; }
.badge.red    { background: rgba(240,68,56,.14);  color: var(--danger); }
.badge.blue   { background: rgba(30,91,255,.12);  color: var(--brand-600); }
.badge.gray   { background: var(--surface-2);     color: var(--text-2); }

/* ── Forms / buttons ────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
input[type=text], input[type=password], input[type=number], input[type=email],
select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand-500); outline-offset: 0; border-color: var(--brand-500);
}
textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-block; padding: 10px 20px; border: 0; cursor: pointer;
  border-radius: var(--radius-sm); font: inherit; font-size: 14px; font-weight: 650;
  background: var(--brand-600); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--brand-500); text-decoration: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 13px; font-size: 13px; }

.alert {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px;
}
.alert.error { background: rgba(240,68,56,.1); color: var(--danger-dark); border: 1px solid rgba(240,68,56,.3); }
.alert.ok    { background: rgba(18,183,106,.1); color: var(--success); border: 1px solid rgba(18,183,106,.3); }

/* ── Login ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand-900) 0%, var(--brand-700) 60%, #0E2B6E 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 400px; padding: 38px 34px;
}
.login-card .logo { font-size: 24px; font-weight: 800; letter-spacing: .04em; margin-bottom: 4px; }
.login-card .logo span { color: var(--brand-600); }

/* ── Consumer verify page ───────────────────────────────── */
.verify-page { max-width: 560px; margin: 0 auto; padding: 24px 18px 80px; }
.verify-brand { text-align: center; padding: 18px 0 26px; font-weight: 800; font-size: 20px; letter-spacing: .05em; }
.verify-brand span { color: var(--brand-600); }

.status-hero {
  border-radius: var(--radius); padding: 30px 24px; text-align: center;
  color: #fff; margin-bottom: 22px;
}
.status-hero.green  { background: linear-gradient(150deg, #0E9355, var(--success)); }
.status-hero.yellow { background: linear-gradient(150deg, #C87100, var(--warn)); }
.status-hero.orange { background: linear-gradient(150deg, #B45309, #EA7B10); }
.status-hero.red    { background: linear-gradient(150deg, #98241B, var(--danger)); }
.status-hero.gray   { background: linear-gradient(150deg, #33415E, #5A6B8C); }
.status-hero .icon { font-size: 44px; }
.status-hero h1 { font-size: 21px; margin: 10px 0 6px; }
.status-hero p { font-size: 14px; opacity: .92; }

/* Product images: stacked vertically, always fit the screen width */
.product-images { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.product-images img {
  width: 100%; max-width: 100%; height: auto; display: block;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  object-fit: contain; cursor: zoom-in;
}

/* Lightbox: click an image to enlarge, click again to close */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center;
  background: rgba(5, 10, 25, .92); padding: 16px; cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* Product video: INLINE, never wider than its column (no popup) */
.video-inline {
  position: relative; width: 100%; max-width: 100%; margin-bottom: 16px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border); background: #000;
}
.video-inline video { width: 100%; max-width: 100%; height: auto; display: block; }
/* "🎬 Video" label – top left, hides during playback */
.video-inline .video-label {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(11, 27, 58, .72); color: #fff;
  font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  pointer-events: none;
}
/* big centered play button */
.video-inline .play-badge {
  position: absolute; inset: 0; margin: auto; z-index: 2;
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(11, 27, 58, .68); color: #fff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  padding-left: 5px;                     /* optical centering of the ▶ */
  box-shadow: 0 2px 14px rgba(0,0,0,.35);
}
.video-inline.playing .video-label,
.video-inline.playing .play-badge { display: none; }

/* ── AI chat ────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.chat .msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius); font-size: 14px; }
.chat .msg.user { align-self: flex-end; background: var(--brand-600); color: #fff; border-bottom-right-radius: 4px; }
.chat .msg.ai   { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; white-space: pre-wrap; }
/* Chat input: field 80% wide, action buttons below */
.chat-input { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 12px; }
.chat-input input { width: 80%; }
.chat-actions { display: flex; gap: 8px; justify-content: center; }
.chat-quota { font-size: 12px; color: var(--text-2); text-align: center; margin-top: 6px; }

/* ── Misc ───────────────────────────────────────────────── */
.pager { display: flex; gap: 10px; align-items: center; margin-top: 16px; font-size: 14px; }
code.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px;
  background: var(--surface-2); padding: 2px 7px; border-radius: 5px; }
.muted { color: var(--text-2); }
.mt { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
details.panel { margin-top: 10px; }
details.panel summary { cursor: pointer; font-weight: 650; font-size: 14px; padding: 6px 0; }
