/* Portail BE — Shared dark design system v4 (Linear) */

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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --bg-input: #1e1e1e;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(99,102,241,0.4);
  --border-focus: rgba(99,102,241,0.6);
  --text: #f1f1f3;
  --text-muted: #a1a1aa;
  --text-dim: #52525b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-bg: rgba(99,102,241,0.1);
  --accent-mid: rgba(99,102,241,0.18);
  --accent-border: rgba(99,102,241,0.35);
  --success: #34d399;
  --success-bg: rgba(52,211,153,0.08);
  --success-border: rgba(52,211,153,0.2);
  --error: #f87171;
  --error-bg: rgba(248,113,113,0.08);
  --error-border: rgba(248,113,113,0.25);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,0.08);
  --warning-border: rgba(251,191,36,0.25);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 20px rgba(99,102,241,0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ── HEADER ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  background: rgba(10,10,10,0.88);
  backdrop-filter: blur(12px);
  z-index: 10;
}
.header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.header-inner a { color: var(--text-muted); transition: color 0.15s; }
.header-inner a:hover { color: var(--text); text-decoration: none; }
.header-inner .sep { color: var(--text-dim); }
.header-brand { font-weight: 700; color: var(--text) !important; display: inline-flex; align-items: center; gap: 6px; letter-spacing: -.01em; }

/* ── BREADCRUMB ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
  list-style: none;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); transition: color .15s; }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb .sep { color: var(--text-dim); }

/* ── MAIN ── */
main { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 32px; }
.page-header h1 { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-bottom: 8px; }
.page-header .subtitle { color: var(--text-muted); font-size: 0.95rem; }

/* ── BACK LINK ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 28px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); text-decoration: none; }

/* ── TOOL CARD ── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

/* ── INFO BOX ── */
.info-box {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 22px;
  line-height: 1.5;
}

/* ── FORM ── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
.field label .hint { font-weight: 400; color: var(--text-dim); margin-left: 4px; }

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 11px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
input.has-error { border-color: var(--error-border) !important; }

/* Select — custom dark arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a1a1aa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

/* Radio pills */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.radio-pill input[type="radio"] { display: none; }
.radio-pill label {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 0;
  letter-spacing: 0;
}
.radio-pill label:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.radio-pill input:checked + label {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Mode toggle */
.mode-toggle { display: flex; gap: 8px; margin-bottom: 22px; }
.mode-btn {
  padding: 9px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.mode-btn.active {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Grid for 2 or 3 column inputs */
.input-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ── BUTTON ── */
.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  letter-spacing: 0.01em;
  box-shadow: none;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.99); }



/* Copy result button */
.btn-copy-result {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: .8rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-copy-result:hover { color: var(--text); border-color: var(--border-hover); }

/* ── MESSAGES ── */
.msg-error {
  display: none;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--error);
  font-size: 0.875rem;
  margin-bottom: 14px;
}
.msg-error.show { display: block; }

.msg-warning {
  display: none;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--warning);
  font-size: 0.82rem;
  margin-top: 14px;
}
.msg-warning.show { display: block; }

/* ── RESULT BLOCK ── */
.result-block { display: none; margin-top: 20px; }
.result-block.show { display: block; }

.result-card {
  background: rgba(99,102,241,0.07);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 14px;
}
.result-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--success);
  margin-bottom: 14px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid rgba(52,211,153,0.1);
  font-size: 0.9rem;
}
.result-row:last-child { border-bottom: none; padding-bottom: 0; }
.result-row .rl { color: var(--text-muted); }
.result-row .rv { font-weight: 600; color: var(--text); }

/* Big result — key value with entrance animation */
.result-row.big .rv {
  font-size: 2.5rem;
  color: #6366f1;
  font-weight: 700;
  letter-spacing: -.03em;
  animation: resultAppear 0.8s ease both;
}
.result-row.big .rl { font-weight: 500; color: var(--text); font-size: 0.9rem; }

@keyframes resultAppear {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.breakdown-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row .bl { color: var(--text-muted); }
.breakdown-row .bv { font-weight: 500; color: var(--text); }
.detail-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-family: 'Menlo', 'Monaco', monospace;
  line-height: 1.8;
  white-space: pre;
}

/* ── DISCLAIMER ── */
.disclaimer {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}

/* ── SHARE ── */
.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

/* ── SEO CONTENT ── */
.seo-content { margin-top: 44px; }
.seo-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: #f1f1f3;
}
.seo-content p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.7;
}
.faq { margin-top: 28px; }
.faq-item {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.faq-item:last-child { border-bottom: 1px solid var(--border); }
.faq-q { font-weight: 600; font-size: 0.875rem; margin-bottom: 6px; color: var(--accent); }
.faq-a { color: var(--text-muted); font-size: 0.85rem; line-height: 1.7; font-weight: 400; }

/* ── RELATED TOOLS ── */
.related-tools {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}
.related-tools h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #f1f1f3;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
/* CRITICAL — flex column layout must be preserved */
.related-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color .2s, box-shadow .2s, transform .2s;
  cursor: pointer;
  text-decoration: none;
}
.related-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
}
.rc-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.rc-icon svg { width: 13px; height: 13px; color: var(--text-muted); stroke-width: 2; }
.rc-name { font-size: .82rem; font-weight: 700; color: var(--text); display: block; margin-bottom: 6px; line-height: 1.3; }
.rc-desc { font-size: .72rem; color: var(--text-muted); display: block; line-height: 1.45; }

/* ── WORD ANIMATION ── */
.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(16px);
  animation: wordIn .5s ease forwards;
}
@keyframes wordIn { to { opacity: 1; transform: translateY(0); } }
.word.ac { color: var(--accent); }

/* ── FOOTER ── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 22px 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 40px;
}
footer a { color: var(--text-muted); transition: color 0.15s; }
footer a:hover { color: var(--text); text-decoration: none; }

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
  main { padding: 28px 16px 60px; }
  .tool-card { padding: 20px 16px; }
  .page-header h1 { font-size: 1.35rem; }
  .input-grid-2 { grid-template-columns: 1fr; }
  .input-grid-3 { grid-template-columns: 1fr 1fr; }
  .result-card, .breakdown-card { padding: 16px; }
  .result-row.big .rv { font-size: 1.6rem; }
  .related-grid { grid-template-columns: 1fr; }
}

/* ── CARD ENTRANCE ANIMATION ── */
/* Note: transition includes border-color + box-shadow to preserve hover effects defined earlier */
.tool-card, .popular-card, .related-card, .breakdown-card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color .2s, box-shadow .2s;
}
.card-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}



/* ── STICKY HEADER SHADOW ── */
header.scrolled {
  box-shadow: 0 1px 0 var(--border), 0 4px 20px rgba(0,0,0,0.4);
}

/* ── BACK TO TOP ── */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  width: 40px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s, border-color 0.15s;
  pointer-events: none;
}
#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#back-to-top:hover { border-color: var(--border-hover); color: var(--text); }

/* ── SHARE BUTTON ── */
.btn-share {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: .8rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}
.btn-share:hover { border-color: var(--border-hover); color: var(--text); }
.btn-share.copied { color: var(--accent); border-color: var(--accent-border); }

/* ── FISCAL TOOLTIPS ── */
.fiscal-term {
  border-bottom: 1px dashed var(--text-dim);
  cursor: help;
  position: relative;
}
.fiscal-term::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e24;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 11px;
  font-size: .72rem;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 50;
  max-width: 280px;
  white-space: normal;
  line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.fiscal-term:hover::after { opacity: 1; }

/* ── LEAD FORM ── */
.lead-form-section {
  margin-top: 40px;
}
.lead-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.lead-form-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.lead-form-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }
.lead-form-header strong {
  display: block;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.lead-form-header p { font-size: .82rem; color: var(--text-muted); margin: 0; }
.lead-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.lead-fields input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s;
}
.lead-fields input::placeholder { color: var(--text-dim); }
.lead-fields input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.btn-lead {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  font-family: inherit;
}
.btn-lead:hover { background: var(--accent-hover); }
.btn-lead:disabled { opacity: .55; cursor: not-allowed; }
.lead-disclaimer {
  font-size: .68rem;
  color: var(--text-dim);
  margin-top: 10px;
  margin-bottom: 0;
}
.lead-success {
  text-align: center;
  color: var(--success);
  font-size: .9rem;
  font-weight: 500;
  padding: 10px 0 2px;
}
@media (max-width: 520px) {
  .lead-fields { grid-template-columns: 1fr; }
}

/* ── LANG SWITCHER (FR / NL) — pill style ── */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  margin-left: auto;
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 2px;
  background: transparent;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  transition: color .15s, background .15s;
  cursor: pointer;
}
.lang-btn:hover { color: var(--text); background: rgba(255,255,255,.06); text-decoration: none; }
.lang-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.lang-active:hover { background: var(--accent-hover); color: #fff; }
.lang-dim {
  opacity: .35;
  cursor: default;
  pointer-events: none;
}
.lang-sep { display: none; }
