/* ═══════════════════════════════════════════════════════════════════════════
   SecpralLearn — main.css — Premium Redesign v2.0
   Aesthetic: Dark Command Center × Engineering Precision
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  /* Core backgrounds — true dark, not blue-tinted */
  --color-bg:           #080808;
  --color-surface:      #101010;
  --color-surface-2:    #161616;
  --color-surface-3:    #1e1e1e;
  --color-surface-4:    #252525;

  /* Borders — razor thin */
  --color-border:       rgba(255,255,255,0.07);
  --color-border-hover: rgba(255,255,255,0.14);
  --color-border-strong:rgba(255,255,255,0.22);

  /* Text */
  --color-text:         #f0f0f0;
  --color-text-muted:   #888;
  --color-text-dim:     #444;

  /* Semantic */
  --color-success:      #16a34a;
  --color-success-dim:  rgba(22,163,74,0.12);
  --color-warning:      #d97706;
  --color-warning-dim:  rgba(217,119,6,0.12);
  --color-danger:       #dc2626;
  --color-danger-dim:   rgba(220,38,38,0.12);
  --color-info:         #2563eb;
  --color-info-dim:     rgba(37,99,235,0.12);

  /* Accent — falls back, overridden per category */
  --accent:             #ef4444;
  --accent-dim:         rgba(239,68,68,0.1);
  --accent-mid:         rgba(239,68,68,0.25);

  /* Category colors */
  --cat-antiincendiu:   #ef4444;
  --cat-antiefractie:   #3b82f6;
  --cat-cctv:           #f59e0b;
  --cat-control-acces:  #10b981;
  --cat-automatizari:   #f97316;
  --cat-videointerfonie:#a855f7;

  /* Typography */
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(0.4,0,0.2,1);
  --t-base: 220ms cubic-bezier(0.4,0,0.2,1);
  --t-slow: 380ms cubic-bezier(0.4,0,0.2,1);

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 32px var(--accent-mid);

  /* Legacy aliases (keep hub.js happy) */
  --color-accent:       var(--accent);
  --color-accent-hover: var(--accent);
  --transition-fast:    var(--t-fast);
  --transition-base:    var(--t-base);
  --transition-slow:    var(--t-slow);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  /* Subtle noise texture overlay */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(var(--accent-rgb,239,68,68),0.04) 0%, transparent 60%);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast), opacity var(--t-fast);
}
a:hover { opacity: 0.8; }

button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }

img { max-width: 100%; display: block; }

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* ── Typography ───────────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h4, h5, h6 { font-family: var(--font-body); font-weight: 600; line-height: 1.3; }

h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.375rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.grid { display: grid; }
.mt-1{margin-top:var(--space-1)}.mt-2{margin-top:var(--space-2)}.mt-4{margin-top:var(--space-4)}.mt-6{margin-top:var(--space-6)}
.mb-2{margin-bottom:var(--space-2)}.mb-4{margin-bottom:var(--space-4)}.mb-6{margin-bottom:var(--space-6)}
.p-2{padding:var(--space-2)}.p-4{padding:var(--space-4)}.p-6{padding:var(--space-6)}

/* ── Color Utils ──────────────────────────────────────────────────────── */
.text-muted  { color: var(--color-text-muted); }
.text-dim    { color: var(--color-text-dim); }
.text-accent { color: var(--accent); }
.text-success{ color: var(--color-success); }
.text-warning{ color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }

/* ── Surfaces ─────────────────────────────────────────────────────────── */
.surface   { background: var(--color-surface);   border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.surface-2 { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.surface-3 { background: var(--color-surface-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--t-fast);
  white-space: nowrap;
  min-height: 40px;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
}
.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-mid);
}
.btn-primary:active { transform: translateY(0); filter: brightness(0.95); }

.btn-secondary {
  background: var(--color-surface-3);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-4);
  border-color: var(--color-border-hover);
}

.btn-ghost {
  color: var(--color-text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-md);
}
.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-surface-3);
}

.btn-sm  { padding: 6px 14px; font-size: 0.8rem; min-height: 34px; }
.btn-lg  { padding: 13px 28px; font-size: 0.95rem; min-height: 50px; }

/* ── Badge / Tag ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-accent  { background: var(--accent-dim); color: var(--accent); }
.badge-success { background: var(--color-success-dim); color: var(--color-success); }
.badge-warning { background: var(--color-warning-dim); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-dim);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-dim);    color: var(--color-info); }
.badge-neutral { background: var(--color-surface-4); color: var(--color-text-muted); border: 1px solid var(--color-border); }

/* ── Tag (monospace chip) ─────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: var(--color-surface-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.tag:hover { border-color: var(--accent); color: var(--accent); }

/* ── EN54 pill ────────────────────────────────────────────────────────── */
.en54-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(37,99,235,0.1);
  border: 1px solid rgba(37,99,235,0.25);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: #60a5fa;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   TOP NAVIGATION
══════════════════════════════════════════════════════════════════════════ */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  display: flex;
  align-items: center;
  background: rgba(8,8,8,0.88);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--color-border);
}

.top-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.nav-logo svg { flex-shrink: 0; color: var(--accent); }

/* ── Search ───────────────────────────────────────────────────────────── */
.search-wrap { position: relative; flex: 1; max-width: 380px; }

.search-input {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 9px 14px 9px 38px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  min-height: 40px;
}
.search-input::placeholder { color: var(--color-text-dim); }
.search-input:focus {
  outline: none;
  background: var(--color-surface-3);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-dim);
  pointer-events: none;
}

/* ── Search Results Dropdown ──────────────────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 300;
}
.search-result-group { padding: 6px 0; }
.search-result-label {
  padding: 6px 14px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-result-item:hover { background: var(--color-surface-3); }
.search-result-code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  min-width: 80px;
  font-weight: 600;
}
.search-result-name { font-size: 0.85rem; flex: 1; }
.search-result-cat {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--color-surface-4);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   CATEGORY HEADER
══════════════════════════════════════════════════════════════════════════ */
.cat-header {
  padding: var(--space-8) 0 var(--space-6);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

/* Accent glow behind header */
.cat-header::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -40px;
  width: 500px;
  height: 300px;
  background: radial-gradient(ellipse, var(--accent-mid) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}

.cat-header .container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  position: relative;
}

.cat-header-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--accent-dim);
  border: 1px solid var(--accent-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.cat-header-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.cat-header-sub {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0;
}

.cat-header-stats {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.cat-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.cat-stat strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}
.cat-stat span, .cat-stat {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* ══════════════════════════════════════════════════════════════════════════
   TAB NAVIGATION
══════════════════════════════════════════════════════════════════════════ */
.tab-nav {
  position: sticky;
  top: 56px;
  z-index: 150;
  background: rgba(8,8,8,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.tab-nav .container { padding-top: 0; padding-bottom: 0; }

.tab-nav-inner {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 2px;
}
.tab-nav-inner::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 14px 18px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  min-height: 48px;
  letter-spacing: 0.01em;
}
.tab-btn svg { opacity: 0.6; transition: opacity var(--t-fast); }
.tab-btn:hover {
  color: var(--color-text);
}
.tab-btn:hover svg { opacity: 1; }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-btn.active svg { opacity: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   PRODUCTS LAYOUT
══════════════════════════════════════════════════════════════════════════ */
.products-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-6);
  padding: var(--space-6) 0;
  align-items: start;
}

/* ── Filter Sidebar ───────────────────────────────────────────────────── */
.filter-sidebar-wrap {
  position: sticky;
  top: calc(56px + 48px + 16px);
}

.filter-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.filter-group { display: flex; flex-direction: column; gap: var(--space-2); }

.filter-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2px;
}

.filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
  border: 1px solid transparent;
}
.filter-option:hover {
  background: var(--color-surface-3);
  color: var(--color-text);
}
.filter-option.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-mid);
  font-weight: 500;
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--color-surface-4);
  color: var(--color-text-dim);
  padding: 1px 6px;
  border-radius: 3px;
}
.filter-option.active .filter-count {
  background: var(--accent-mid);
  color: var(--accent);
}

/* filter toggle (mobile) */
.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 16px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: var(--space-4);
  min-height: 44px;
  width: 100%;
}
@media (max-width: 860px) {
  .filter-toggle-btn { display: flex; }
  .filter-sidebar-wrap { position: static; }
  .filter-sidebar-wrap:not(.open) .filter-sidebar { display: none; }
}

/* ── Product Grid ─────────────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

/* ── Product Card ─────────────────────────────────────────────────────── */
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  cursor: pointer;
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base), background var(--t-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
}

/* Accent left bar */
.product-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: transparent;
  transition: background var(--t-base);
}
.product-card:hover::before { background: var(--accent); }

.product-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.product-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.product-code {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.product-brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid currentColor;
  opacity: 0.9;
  font-family: var(--font-mono);
}

.product-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.product-desc {
  font-size: 0.81rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-tags {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  margin-top: 2px;
}

.product-type-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--color-surface-4);
  color: var(--color-text-muted);
  text-transform: uppercase;
  border: 1px solid var(--color-border);
}

/* ── Products Header ──────────────────────────────────────────────────── */
#products-header {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-5);
}

/* ══════════════════════════════════════════════════════════════════════════
   BRAND GRID
══════════════════════════════════════════════════════════════════════════ */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
  padding: var(--space-6) 0;
}

.brand-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  cursor: pointer;
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  overflow: hidden;
}

.brand-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60px; height: 60px;
  background: radial-gradient(circle at top right, var(--brand-color,#fff) 0%, transparent 70%);
  opacity: 0.06;
  transition: opacity var(--t-base);
}

.brand-card:hover {
  border-color: var(--brand-color, var(--accent));
  background: var(--color-surface-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.brand-card:hover::after { opacity: 0.1; }

.brand-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand-logo-circle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.brand-stats {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.brand-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-stat-val {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}
.brand-stat-lbl {
  font-size: 0.65rem;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-mono);
}

/* ── Brand Detail ─────────────────────────────────────────────────────── */
.brand-detail-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.brand-detail-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.brand-detail-stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.brand-detail-stat-val {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.brand-detail-stat-lbl {
  font-size: 0.7rem;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

/* ══════════════════════════════════════════════════════════════════════════
   SYSTEM ARCHITECTURE DIAGRAM
══════════════════════════════════════════════════════════════════════════ */
.arch-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: var(--space-8) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.arch-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.arch-connector {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, var(--accent-mid), var(--color-border));
  position: relative;
}
.arch-connector::after {
  content: '';
  position: absolute;
  bottom: -4px; left: -4px;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-border);
}

.arch-node {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  text-align: center;
  min-width: 220px;
  max-width: 92%;
  transition: border-color var(--t-fast);
}
.arch-node:hover { border-color: var(--accent); }

.arch-node-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-dim);
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
}

.arch-node-codes {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.arch-row {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.arch-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Admin select */
.admin-select {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 8px 12px;
  cursor: pointer;
  min-height: 40px;
}
.admin-select:focus { outline: none; border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   COMPATIBILITY TABLE
══════════════════════════════════════════════════════════════════════════ */
.compat-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.compat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 500px;
}
.compat-table thead tr {
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border-strong);
}
.compat-table th {
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.compat-table th:first-child { text-align: left; }
.compat-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
  vertical-align: middle;
}
.compat-table td:first-child {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface-2);
  white-space: nowrap;
  position: sticky;
  left: 0;
}
.compat-table tr:last-child td { border-bottom: none; }
.compat-table tr:hover td { background: var(--color-surface-2); }
.compat-table tr:hover td:first-child { background: var(--color-surface-3); }

.compat-icon { font-size: 1.1rem; cursor: pointer; }
.compat-yes   { color: var(--color-success); }
.compat-partial { color: var(--color-warning); }
.compat-no    { color: var(--color-danger); }

.compat-note {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  text-align: left;
  max-width: 200px;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════════════════
   QUIZ
══════════════════════════════════════════════════════════════════════════ */
.quiz-container {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.quiz-score-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  text-align: center;
}

.quiz-score-number {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-2);
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.quiz-progress-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.quiz-question-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-5);
}

.quiz-question-text {
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 13px 16px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: left;
  width: 100%;
  min-height: 52px;
  font-size: 0.9rem;
  color: var(--color-text);
}
.quiz-option:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--color-text);
}
.quiz-option.selected   { border-color: var(--accent); background: var(--accent-dim); }
.quiz-option.correct    { border-color: var(--color-success); background: var(--color-success-dim); color: var(--color-text); }
.quiz-option.incorrect  { border-color: var(--color-danger);  background: var(--color-danger-dim);  color: var(--color-text); }
.quiz-option.revealed-correct { border-color: var(--color-success); background: var(--color-success-dim); }
.quiz-option:disabled, .quiz-option[disabled] { cursor: default; pointer-events: none; }

.quiz-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-4);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.quiz-option.correct .quiz-letter   { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.quiz-option.incorrect .quiz-letter { background: var(--color-danger);  color: #fff; border-color: var(--color-danger); }
.quiz-option.revealed-correct .quiz-letter { background: var(--color-success); color: #fff; }

/* ── Progress Bar ─────────────────────────────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--color-surface-4);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width var(--t-slow);
}

/* ══════════════════════════════════════════════════════════════════════════
   GLOSSARY
══════════════════════════════════════════════════════════════════════════ */
.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--space-4) 0;
}

.glossary-item {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-6);
  align-items: start;
  transition: background var(--t-fast);
}
.glossary-item:last-child { border-bottom: none; }
@media (max-width: 720px) {
  .glossary-item { grid-template-columns: 1fr; gap: var(--space-3); }
}

.glossary-term {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.glossary-term > span:first-child,
.glossary-term-text {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.glossary-def {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin: 0;
}

.glossary-meta {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   PRODUCT DETAIL (modal body)
══════════════════════════════════════════════════════════════════════════ */
.prod-detail-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.prod-detail-section {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.prod-detail-section:last-child { border-bottom: none; margin-bottom: 0; }

.prod-detail-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-dim);
  font-family: var(--font-mono);
  margin-bottom: var(--space-4);
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}

/* ── Spec Table ───────────────────────────────────────────────────────── */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.spec-table tr { border-bottom: 1px solid var(--color-border); }
.spec-table tr:last-child { border-bottom: none; }
.spec-table td { padding: 9px 12px; vertical-align: top; }
.spec-table td:first-child {
  color: var(--color-text-muted);
  width: 42%;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ══════════════════════════════════════════════════════════════════════════
   DOC CARDS
══════════════════════════════════════════════════════════════════════════ */
.doc-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--t-fast);
}
.doc-card:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface-3);
}
.doc-card-icon { color: var(--color-text-dim); flex-shrink: 0; }
.doc-card-info { flex: 1; min-width: 0; }
.doc-card-title { font-size: 0.84rem; font-weight: 500; color: var(--color-text); }
.doc-card-sub   { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(24px) scale(0.98);
  transition: transform var(--t-base);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
  backdrop-filter: blur(8px);
}
.modal-close {
  color: var(--color-text-dim);
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  border: 1px solid transparent;
}
.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface-3);
  border-color: var(--color-border);
}
.modal-body { padding: var(--space-6); }

/* ══════════════════════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════════════════════ */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-6);
  text-align: center;
  color: var(--color-text-dim);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  margin-top: var(--space-12);
}
.site-footer a { color: var(--color-text-muted); transition: color var(--t-fast); }
.site-footer a:hover { color: var(--color-text); }

/* ══════════════════════════════════════════════════════════════════════════
   LOADING / EMPTY STATES
══════════════════════════════════════════════════════════════════════════ */
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--color-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-6);
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--color-text-dim);
  font-size: 0.875rem;
}
.empty-state svg { opacity: 0.2; }
.empty-state h3 { color: var(--color-text-dim); font-size: 1rem; }

/* ══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown{ from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.animate-fade      { animation: fadeIn   var(--t-base) both; }
.animate-slide-up  { animation: slideUp  var(--t-base) both; }
.animate-scale     { animation: scaleIn  var(--t-base) both; }

/* Staggered grid children */
.product-grid > *  { animation: slideUp var(--t-base) both; }
.product-grid > *:nth-child(1)  { animation-delay: 0ms; }
.product-grid > *:nth-child(2)  { animation-delay: 30ms; }
.product-grid > *:nth-child(3)  { animation-delay: 60ms; }
.product-grid > *:nth-child(4)  { animation-delay: 90ms; }
.product-grid > *:nth-child(5)  { animation-delay: 120ms; }
.product-grid > *:nth-child(6)  { animation-delay: 150ms; }
.product-grid > *:nth-child(n+7){ animation-delay: 180ms; }

.brand-grid > *    { animation: slideUp var(--t-base) both; }
.brand-grid > *:nth-child(1){ animation-delay: 0ms; }
.brand-grid > *:nth-child(2){ animation-delay: 50ms; }
.brand-grid > *:nth-child(3){ animation-delay: 100ms; }
.brand-grid > *:nth-child(n+4){ animation-delay: 150ms; }

/* ══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-surface-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-hover); }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .products-layout { grid-template-columns: 200px 1fr; gap: var(--space-4); }
}

@media (max-width: 860px) {
  .products-layout { grid-template-columns: 1fr; }
  .cat-header .container { flex-direction: column; align-items: flex-start; }
  .cat-header-stats { border-top: 1px solid var(--color-border); padding-top: var(--space-4); margin-top: var(--space-2); width: 100%; justify-content: space-between; }
  .cat-stat { align-items: flex-start; }
  .brand-detail-header { flex-direction: column; }
}

@media (max-width: 640px) {
  .container { padding: 0 var(--space-4); }
  .product-grid { grid-template-columns: 1fr; }
  .brand-grid { grid-template-columns: 1fr; }
  .quiz-question-card { padding: var(--space-4); }
  .quiz-score-card { padding: var(--space-8) var(--space-4); }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .tab-btn { padding: 12px 14px; font-size: 0.8rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   GLOSSARY SEARCH INPUT (in tab content)
══════════════════════════════════════════════════════════════════════════ */
#glossary-search {
  width: 100%;
  max-width: 480px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  padding: 10px 16px;
  margin-bottom: var(--space-5);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 42px;
}
#glossary-search::placeholder { color: var(--color-text-dim); }
#glossary-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ══════════════════════════════════════════════════════════════════════════
   SECTION HEADERS inside tabs
══════════════════════════════════════════════════════════════════════════ */
.tab-section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.tab-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.tab-section-sub {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ── Info / rule boxes ────────────────────────────────────────────────── */
.info-box {
  background: var(--color-info-dim);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  font-size: 0.875rem;
  color: #93c5fd;
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

/* ── Selection highlight ──────────────────────────────────────────────── */
::selection { background: var(--accent-mid); color: var(--color-text); }
