/* ══════════════════════════════════════════
   FRIBOURG EXPORT – riskanalyzer.css
   Dark tech / Swiss precision aesthetic
══════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --red:         #E8192C;
  --red-hover:   #c9111f;
  --red-glow:    rgba(232,25,44,0.3);
  --gold:        #D4A83A;
  --dark:        #080b10;
  --dark2:       #0d1018;
  --card-bg:     rgba(13,16,24,0.9);
  --card-border: rgba(255,255,255,0.08);
  --text:        #ffffff;
  --muted:       rgba(255,255,255,0.55);
  --dim:         rgba(255,255,255,0.3);
  --green:       #22c55e;
  --green-bg:    rgba(34,197,94,0.12);
  --orange:      #f59e0b;
  --orange-bg:   rgba(245,158,11,0.12);
  --high:        #ef4444;
  --high-bg:     rgba(239,68,68,0.12);
  --vhigh:       #dc2626;
  --vhigh-bg:    rgba(220,38,38,0.15);
  --font:        'Barlow', sans-serif;
  --font-cond:   'Barlow Condensed', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated grid background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,25,44,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,25,44,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}


.c-tl { top: 8px; left: 8px; }
.c-tl::before { top: 0; left: 0; }
.c-tl::after  { top: 0; left: 0; }

.c-tr { top: 8px; right: 8px; }
.c-tr::before { top: 0; right: 0; }
.c-tr::after  { top: 0; right: 0; }

.c-bl { bottom: 8px; left: 8px; }
.c-bl::before { bottom: 0; left: 0; }
.c-bl::after  { bottom: 0; left: 0; }

.c-br { bottom: 8px; right: 8px; }
.c-br::before { bottom: 0; right: 0; }
.c-br::after  { bottom: 0; right: 0; }

/* ══ NAVBAR ══ */
.navbar {
  position: sticky; top: 0;
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(8,11,16,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 200;
}

.logo {
  display: flex; align-items: center; gap: 11px;
  cursor: pointer;
}
.logo-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px; /* optional nice touch */
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.logo-text {
  display: flex; flex-direction: column; line-height: 1;
}
.logo-name {
  font-family: var(--font-cond); font-weight: 800;
  font-size: 15px; letter-spacing: 0.08em;
}
.logo-tagline {
  font-size: 9px; font-weight: 500;
  letter-spacing: 0.14em; color: var(--muted); margin-top: 3px;
}

.nav-center { display: flex; gap: 6px; }
.nav-link {
  color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 500; letter-spacing: 0.02em;
  padding: 5px 12px; border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  position: relative;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-link.active { color: #fff; }
.nav-link.active::after {
  content: '';
  position: absolute; bottom: -3px; left: 12px; right: 12px;
  height: 2px; background: var(--red); border-radius: 1px;
}

.nav-right { display: flex; align-items: center; gap: 18px; }
.secure-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--muted);
}
.lang-sel { font-size: 13px; font-weight: 600; cursor: pointer; }

/* ══ PAGE LAYOUT ══ */
.page {
  position: relative; z-index: 1;
  max-width: 1280px; margin: 0 auto;
  padding: 36px 28px 80px;
}

/* ══ BREADCRUMB ══ */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--dim); margin-bottom: 28px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .sep { color: var(--dim); }
.breadcrumb .current { color: var(--red); font-weight: 600; }

/* ══ PAGE HEADER ══ */
.analyzer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 32px; gap: 20px; flex-wrap: wrap;
}
.header-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--red); text-transform: uppercase; margin-bottom: 8px;
}
.header-title {
  font-family: var(--font-cond);
  font-weight: 800; font-size: 38px; line-height: 1.05;
  letter-spacing: -0.01em;
}
.header-title span { color: var(--red); }
.header-meta {
  display: flex; align-items: center; gap: 14px;
  margin-top: 12px; flex-wrap: wrap;
}
.meta-chip {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 5px 14px;
  font-size: 13px; font-weight: 500; color: #fff;
}
.meta-chip .chip-icon { font-size: 15px; }

.header-right {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 10px;
}
.overall-score-box {
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 18px 28px;
  min-width: 160px;
}
.score-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase;
}
.score-value {
  font-family: var(--font-cond); font-weight: 800;
  font-size: 52px; line-height: 1; margin: 4px 0;
}
.score-text {
  font-family: var(--font-cond); font-weight: 700;
  font-size: 16px; letter-spacing: 0.06em;
}

.re-run-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 7px; color: var(--muted);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 8px 16px; cursor: pointer; transition: all 0.2s;
}
.re-run-btn:hover { border-color: var(--red); color: #fff; }

/* ══ LOADING STATE ══ */
.loading-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 60vh; gap: 28px;
  animation: fadeIn 0.4s ease;
}
.loading-ring {
  width: 72px; height: 72px;
  border: 3px solid rgba(232,25,44,0.15);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-family: var(--font-cond); font-size: 18px; font-weight: 700;
  letter-spacing: 0.06em; color: var(--muted);
}
.loading-steps {
  display: flex; flex-direction: column;
  gap: 10px; align-items: center;
}
.loading-step {
  font-size: 12.5px; color: var(--dim);
  display: flex; align-items: center; gap: 8px;
  transition: color 0.3s;
}
.loading-step.done   { color: var(--green); }
.loading-step.active { color: #fff; }
.step-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ══ RESULTS ══ */
.results-hidden  { display: none; }
.results-visible {
  display: block;
  animation: fadeIn 0.5s ease;
}

/* Summary bar */
.summary-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 32px;
}
.summary-stat {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase;
}
.stat-value { font-family: var(--font-cond); font-weight: 800; font-size: 28px; }
.stat-sub   { font-size: 11.5px; color: var(--muted); }

/* Category grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* Category card */
.cat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; overflow: hidden;
  transition: border-color 0.25s, transform 0.2s;
}
.cat-card:hover { transform: translateY(-2px); }

.cat-card.risk-low         { border-color: rgba(34,197,94,0.25); }
.cat-card.risk-low:hover   { border-color: rgba(34,197,94,0.5); }
.cat-card.risk-medium      { border-color: rgba(245,158,11,0.25); }
.cat-card.risk-medium:hover{ border-color: rgba(245,158,11,0.5); }
.cat-card.risk-high        { border-color: rgba(239,68,68,0.25); }
.cat-card.risk-high:hover  { border-color: rgba(239,68,68,0.5); }
.cat-card.risk-very-high      { border-color: rgba(220,38,38,0.35); }
.cat-card.risk-very-high:hover{ border-color: rgba(220,38,38,0.6); }

/* Card header */
.cat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; cursor: pointer; user-select: none;
}
.cat-header-left  { display: flex; align-items: center; gap: 12px; }
.cat-header-right { display: flex; align-items: center; gap: 10px; }

.cat-number {
  font-family: var(--font-cond); font-size: 11px; font-weight: 800;
  letter-spacing: 0.1em; color: var(--dim); min-width: 24px;
}
.cat-icon { font-size: 20px; }
.cat-name {
  font-family: var(--font-cond); font-weight: 700;
  font-size: 15px; letter-spacing: 0.02em;
}

.risk-badge {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 4px;
}
.badge-low       { background: var(--green-bg);  color: var(--green); }
.badge-medium    { background: var(--orange-bg); color: var(--orange); }
.badge-high      { background: var(--high-bg);   color: var(--high); }
.badge-very-high { background: var(--vhigh-bg);  color: #ff6b6b; }

.score-pill {
  font-family: var(--font-cond); font-size: 14px; font-weight: 800;
  min-width: 38px; text-align: right;
}
.pill-low       { color: var(--green); }
.pill-medium    { color: var(--orange); }
.pill-high      { color: var(--high); }
.pill-very-high { color: #ff6b6b; }

.expand-icon {
  font-size: 12px; color: var(--dim);
  transition: transform 0.25s;
}
.cat-card.open .expand-icon { transform: rotate(180deg); }


/* ══════════ BACKGROUND ══════════ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.bg-img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(5,8,14,0.88) 0%,
    rgba(5,8,14,0.72) 40%,
    rgba(5,8,14,0.55) 70%,
    rgba(5,8,14,0.78) 100%
  );
}

/* Progress bar */
.cat-progress {
  height: 3px; margin: 0 18px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px; overflow: hidden;
}
.cat-progress-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.fill-low       { background: var(--green); }
.fill-medium    { background: var(--orange); }
.fill-high      { background: var(--high); }
.fill-very-high { background: #ff6b6b; }

/* Card body (accordion) */
.cat-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1);
  padding: 0 18px;
}
.cat-card.open .cat-body { max-height: 600px; padding: 0 18px; }
.cat-body-inner {
  padding: 14px 0 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 12px;
}

.cat-summary {
  font-size: 13.5px; color: rgba(255,255,255,0.78);
  line-height: 1.65; margin-bottom: 14px;
}

.findings-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 8px;
}
.finding-item {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; color: rgba(255,255,255,0.65); line-height: 1.5;
}
.finding-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--red); flex-shrink: 0; margin-top: 6px;
}

.data-sources {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px;
}
.source-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--dim); background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px; padding: 3px 8px;
}

/* ══ RECOMMENDATION PANEL ══ */
.rec-panel {
  margin-top: 28px;
  background: var(--card-bg);
  border: 1px solid rgba(232,25,44,0.2);
  border-radius: 12px; padding: 24px 26px;
}
.rec-title {
  font-family: var(--font-cond); font-weight: 800; font-size: 18px;
  letter-spacing: 0.04em; color: var(--red); margin-bottom: 16px;
}
.rec-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.rec-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px; padding: 14px 15px;
}
.rec-item-title { font-size: 12.5px; font-weight: 700; color: #fff; margin-bottom: 7px; }
.rec-item-text  { font-size: 12px; color: var(--muted); line-height: 1.55; }

/* ══ BOTTOM BAR ══ */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 36px; z-index: 100;
  background: rgba(8,11,16,0.85); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 28px;
}
.bottom-tagline {
  font-family: var(--font-cond); font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; color: var(--dim); text-transform: uppercase;
}



/* ══════════ POPUP ══════════ */
.popup {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(10, 14, 20, 0.95);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: auto;
  transition: all 0.25s ease;
  z-index: 9999;
}

.popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.popup-link {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
  transition: color 0.2s, text-shadow 0.2s;
}

.popup-link:hover {
  color: #fff;
  text-shadow: 0 0 8px var(--red-glow);
}

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  .categories-grid { grid-template-columns: 1fr; }
  .summary-bar     { grid-template-columns: repeat(2, 1fr); }
  .rec-grid        { grid-template-columns: 1fr; }
  .header-right    { align-items: flex-start; }
  .nav-center      { display: none; }
}

/* ══ UTILITY ══ */
.hidden { display: none !important; }

/* ══ CATEGORY ICON IMAGE ══ */
/* Replaces inline style="width:22px;height:22px;object-fit:contain" */
.cat-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}


/* ══ ERROR PANEL ══ */
/* Shown by JS when a product/country combo is missing from risks.json */
.error-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease;
}

.error-icon {
  font-size: 36px;
}

.error-title {
  font-family: var(--font-cond);
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
}

.error-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
}

.error-body strong {
  color: #fff;
}

.error-body code {
  color: var(--red);
  font-size: 13px;
}

.error-btn {
  background: var(--red);
  border: none;
  border-radius: 7px;
  color: #fff;
  font-family: var(--font-cond);
  font-size: 15px;
  font-weight: 700;
  padding: 11px 24px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: background 0.2s, transform 0.15s;
  margin-top: 4px;
}

.error-btn:hover {
  background: var(--red-hover);
  transform: translateY(-1px);
}

.error-btn:active {
  transform: translateY(0);
}

.bottom-emblem {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.bottom-emblem .emblem-cross {
  width: 22px;
  height: 22px;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  clip-path: polygon(40% 0%, 60% 0%, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0% 60%, 0% 40%, 40% 40%);
}