/*
  Nickel Release Calculator — Stylesheet
  Poli International | 2026
*/

:root {
  --brand-cyan: #0693e3;

  --safe:        #38a169;
  --borderline:  #d69e2e;
  --unsafe:      #e53e3e;
  --variable:    #805ad5;

  --text-primary:   #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted:     #707070;

  --bg-page:  #0f0f0f;
  --bg-card:  #1a1a1a;
  --bg-input: #222222;
  --bg-hover: #2a2a2a;
  --bg-tag:   #2c2c2c;

  --border:       rgba(255,255,255,0.1);
  --border-focus: var(--brand-cyan);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-md: 0 4px 14px rgba(0,0,0,0.55);

  --font:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Consolas, monospace;
}

[data-theme="light"] {
  --text-primary:   #1a1a1a;
  --text-secondary: #555555;
  --text-muted:     #888888;
  --bg-page:  #f5f5f5;
  --bg-card:  #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f0f0f0;
  --bg-tag:   #eaeaea;
  --border:   rgba(0,0,0,0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

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

.tool-wrapper {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ─── Header ──────────────────────────────────────────────────── */
.tool-header {
  text-align: center;
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.tool-header__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(6,147,227,0.12);
  border: 1px solid rgba(6,147,227,0.35);
  color: var(--brand-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.tool-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.tool-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
}

/* ─── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.3rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.tab-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.tab-btn.active { background: var(--brand-cyan); color: #fff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Input cards ─────────────────────────────────────────────── */
.input-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.search-row { display: flex; gap: 0.5rem; }

.input-field {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: border-color 0.18s;
  width: 100%;
}
.input-field:focus { border-color: var(--border-focus); }
.input-field::placeholder { color: var(--text-muted); }

select.input-field { cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-primary { background: var(--brand-cyan); color: #fff; }
.btn-primary:hover { background: #0578c8; }

.input-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.55rem; line-height: 1.5; }

/* ─── Calc form ───────────────────────────────────────────────── */
.calc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.calc-field { display: flex; flex-direction: column; gap: 0.35rem; }

/* ─── Calc result card ────────────────────────────────────────── */
.calc-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 1.25rem;
}

.calc-result-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.calc-result-icon { font-size: 1.5rem; flex-shrink: 0; }
.calc-result-main { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); }
.calc-result-sub  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.calc-badge       { margin-left: auto; }

.calc-stats {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.calc-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
  font-size: 0.82rem;
}
.calc-stat-row + .calc-stat-row { border-top: 1px solid var(--border); margin-top: 0.3rem; padding-top: 0.3rem; }
.calc-stat-label { color: var(--text-muted); }
.calc-stat-value { font-weight: 600; color: var(--text-primary); }

/* ─── Limits section ──────────────────────────────────────────── */
.limit-section { display: flex; flex-direction: column; gap: 0.85rem; margin-bottom: 1rem; }
.limit-row { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem 1rem; }
.limit-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.65rem; }
.limit-label { font-size: 0.8rem; color: var(--text-secondary); flex: 1; }
.limit-value { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }

/* ─── Gauge bar ───────────────────────────────────────────────── */
.gauge-wrap { margin-top: 0.35rem; }
.gauge-track {
  position: relative;
  height: 8px;
  background: var(--bg-tag);
  border-radius: 999px;
  overflow: visible;
}
.gauge-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
  position: relative;
  z-index: 1;
}
.gauge-limit {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 16px;
  background: var(--text-muted);
  z-index: 2;
  transform: translateX(-50%);
}
.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ─── Recommendations ─────────────────────────────────────────── */
.recommendation {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 0.85rem;
  border: 1px solid;
}
.recommendation--safe       { background: rgba(56,161,105,0.1);  border-color: rgba(56,161,105,0.35);  color: #68d391; }
.recommendation--borderline { background: rgba(214,158,46,0.1);  border-color: rgba(214,158,46,0.35);  color: #f6d860; }
.recommendation--unsafe     { background: rgba(229,62,62,0.1);   border-color: rgba(229,62,62,0.35);   color: #fc8181; }

.calc-disclaimer { font-size: 0.72rem; color: var(--text-muted); line-height: 1.55; }
.calc-error { padding: 0.75rem 1rem; background: rgba(229,62,62,0.1); border: 1px solid rgba(229,62,62,0.35); border-radius: var(--radius-sm); color: #fc8181; font-size: 0.85rem; }

/* ─── Result cards (lookup) ───────────────────────────────────── */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.18s;
  margin-bottom: 0.75rem;
}
.result-card:hover { box-shadow: var(--shadow-md); }

.result-card--safe         { border-left: 4px solid var(--safe); }
.result-card--borderline   { border-left: 4px solid var(--borderline); }
.result-card--non_compliant { border-left: 4px solid var(--unsafe); }
.result-card--variable     { border-left: 4px solid var(--variable); }

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
}
.card-header:hover { background: var(--bg-hover); }

.card-status-icon { font-size: 1.25rem; flex-shrink: 0; line-height: 1; }
.card-title-block { flex: 1; min-width: 0; }
.card-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-name-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.card-badges { display: flex; gap: 0.35rem; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.card-chevron { font-size: 0.75rem; color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.result-card.expanded .card-chevron { transform: rotate(180deg); }

.card-body { display: none; padding: 0 1rem 1rem; border-top: 1px solid var(--border); }
.result-card.expanded .card-body { display: block; }
.card-notes { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.65; margin-top: 0.85rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; margin-top: 0.85rem; }
.detail-item { display: flex; flex-direction: column; gap: 0.2rem; }
.detail-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.detail-value { font-size: 0.82rem; color: var(--text-primary); }
.detail-value code { font-family: var(--font-mono); font-size: 0.78rem; background: var(--bg-tag); padding: 0.1rem 0.4rem; border-radius: 3px; }

.detail-section { margin-top: 0.75rem; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.detail-tag { font-size: 0.72rem; background: var(--bg-tag); color: var(--text-secondary); padding: 0.18rem 0.55rem; border-radius: 999px; border: 1px solid var(--border); }

.card-action-row { display: flex; gap: 0.5rem; margin-top: 0.85rem; flex-wrap: wrap; }
.card-action-row a {
  font-size: 0.78rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); transition: all 0.18s;
}
.card-action-row a:hover { background: var(--bg-hover); color: var(--brand-cyan); text-decoration: none; border-color: var(--brand-cyan); }

/* ─── Poli highlight ──────────────────────────────────────────── */
.poli-highlight {
  display: flex; align-items: flex-start; gap: 0.75rem;
  margin-top: 0.85rem; padding: 0.75rem 1rem;
  background: rgba(6,147,227,0.08); border: 1px solid rgba(6,147,227,0.3);
  border-radius: var(--radius-sm); font-size: 0.82rem; color: var(--text-secondary); line-height: 1.55;
}
.poli-highlight__logo {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0;
  background: var(--brand-cyan); color: #fff; font-size: 0.7rem; font-weight: 700; border-radius: 50%;
}

/* ─── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge--safe        { background: rgba(56,161,105,0.18);  color: #68d391; border: 1px solid rgba(56,161,105,0.35); }
.badge--borderline  { background: rgba(214,158,46,0.18);  color: #f6d860; border: 1px solid rgba(214,158,46,0.35); }
.badge--unsafe      { background: rgba(229,62,62,0.18);   color: #fc8181; border: 1px solid rgba(229,62,62,0.35); }
.badge--variable    { background: rgba(128,90,213,0.18);  color: #d6bcfa; border: 1px solid rgba(128,90,213,0.35); }
.badge--neutral     { background: var(--bg-tag); color: var(--text-muted); border: 1px solid var(--border); }
.badge--info        { background: rgba(49,130,206,0.15);  color: #90cdf4; border: 1px solid rgba(49,130,206,0.3); }

/* ─── Not-found card ──────────────────────────────────────────── */
.not-found-card {
  display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border); border-left: 4px solid var(--text-muted);
  border-radius: var(--radius-md);
}
.not-found-card .nf-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }
.not-found-card .nf-text { font-size: 0.85rem; }
.not-found-card .nf-name { font-weight: 700; color: var(--text-primary); }
.not-found-card .nf-sub  { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.25rem; line-height: 1.55; }

/* ─── Idle state ──────────────────────────────────────────────── */
.idle-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.idle-state__icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.idle-state__text { font-size: 0.875rem; }
.idle-state__text em { color: var(--text-secondary); font-style: normal; }

/* ─── Disclaimer ──────────────────────────────────────────────── */
.disclaimer {
  margin-top: 2rem; padding: 0.85rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 0.75rem; color: var(--text-muted); line-height: 1.6;
}
.disclaimer strong { color: var(--text-secondary); }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tool-header h1 { font-size: 1.35rem; }
  .search-row { flex-direction: column; }
  .calc-form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .card-badges { display: none; }
  .tabs { flex-direction: column; }
  .calc-result-header { flex-wrap: wrap; }
  .limit-header { flex-wrap: wrap; }
}
