/* =================================================================
   shared.css — Design system partagé — calculetontaux.fr
   ================================================================= */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --bg:           #f8f7f4;
  --surface:      #fff;
  --border:       #e8e6e0;
  --text:         #1a1a18;
  --muted:        #6b6b66;
  --accent:       #1a6b4a;
  --accent-light: #e8f4ee;
  --accent-mid:   #2d9968;
  --danger:       #7a3020;   /* Wada Sanzo — brun-rouge mutré */
  --danger-bg:    #f4ece8;
  --danger-border:#c8a090;
  --negative:     #8b3a28;   /* pour valeurs négatives */
  --radius:       12px;
  --radius-sm:    8px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.6;
}

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

/* ── Nav sticky ─────────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-nav__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav__logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.site-nav__logo img { display: block; }

/* Pill container */
.site-nav__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  flex: 1;
  position: relative;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 100px;
  overflow: visible;
}

.site-nav__link {
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  font-size: 0.84rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
  position: relative;
  z-index: 1;
}

.site-nav__link:hover {
  color: var(--text);
  text-decoration: none;
}

.site-nav__link.active {
  color: var(--text);
  font-weight: 600;
}

.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.nav-tool {
  color: var(--muted);
  font-style: italic;
}
.nav-tool.active {
  color: var(--text);
  font-weight: 600;
}

/* Indicateur glissant (tubelight) */
.nav-indicator {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 100px;
  background: var(--bg);
  pointer-events: none;
  z-index: 0;
  transition: left  0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
              width 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Barre lumineuse au sommet */
.nav-indicator::before {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--text);
}

/* Halo diffus au-dessus */
.nav-indicator::after {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  filter: blur(10px);
  opacity: 0.10;
}

/* ── Container ──────────────────────────────────────────────────── */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ── Section (card blanche) ─────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-desc {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.55;
}

/* ── Forms ──────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field:last-child { margin-bottom: 0; }

label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent-mid);
}

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='%236b6b66' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* Range — thumb vert */
input[type="range"] {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

/* ── TMI Badge (pill verte) ─────────────────────────────────────── */
.tmi-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ── Bouton primaire ────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn-primary:hover {
  opacity: 0.82;
  text-decoration: none;
  color: var(--bg);
}

/* ── Grille résultats (2 colonnes) ──────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.result-card.highlight {
  background: var(--accent-light);
  border-color: var(--accent-mid);
}

.result-card__label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.result-card__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.result-card.highlight .result-card__value {
  color: var(--accent);
}

/* ── Tableau ────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ── Barre de répartition ───────────────────────────────────────── */
.bar-wrap { margin-top: 0.5rem; }

.bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* ── Import banner (verte + dot animé) ──────────────────────────── */
.import-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.84rem;
  color: var(--accent);
}

.import-banner .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-mid);
  flex-shrink: 0;
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

/* ── Bottom nav (mobile uniquement) ────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  gap: 0.2rem;
  z-index: 100;
}

.bottom-nav__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.3rem 0.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}

.bottom-nav__link.active { color: var(--accent); }

/* ── Footer ─────────────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 2rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.page-footer a { color: var(--muted); text-decoration: underline; }

/* ── Dark mode ──────────────────────────────────────────────────── */
html.dark {
  --bg:           #18181a;
  --surface:      #222224;
  --border:       #2e2e32;
  --text:         #e8e6e0;
  --muted:        #8a8a84;
  --accent:       #4db882;
  --accent-light: #1a3328;
  --accent-mid:   #3da870;
  --danger:       #c8806a;
  --danger-bg:    #2c1a16;
  --danger-border:#5a3028;
  --negative:     #c87060;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.theme-toggle:hover { color: var(--text); }

/* Icônes soleil/lune */
html:not(.dark) .theme-icon--moon { display: none; }
html.dark        .theme-icon--sun  { display: none; }

/* ── En-tête de page ────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: clamp(1.2rem, 4vw + 0.4rem, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.page-desc {
  font-size: clamp(0.82rem, 2vw + 0.4rem, 0.9rem);
  color: var(--muted);
  line-height: 1.6;
  max-width: 540px;
}

/* ── Section "Et maintenant ?" ──────────────────────────────────── */
.next-steps {
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

.next-steps-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.next-steps-sub {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: -0.35rem;
}

.next-steps-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: var(--font);
}

.btn-next--default {
  background: var(--text);
  color: var(--bg);
  border: 1px solid transparent;
}
.btn-next--default:hover { opacity: 0.82; text-decoration: none; color: var(--bg); }

.btn-next--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-next--outline:hover {
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}

/* ── Utilitaires ────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .site-nav__inner { padding: 0 1rem; gap: 1rem; }
  .container { padding: 1.5rem 1rem 5rem; }
  .results-grid { grid-template-columns: 1fr; }
  .section { padding: 1.25rem 1rem; }
}

@media (max-width: 480px) {
  /* Cache le texte du logo, garde juste l'icône */
  .site-nav__logo span { display: none; }

  /* Nav simplifiée : retire le pill et l'indicateur */
  .site-nav__links {
    border: none;
    padding: 0;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  .site-nav__link {
    padding: 0.25rem 0.6rem;
    font-size: 0.82rem;
  }
  .nav-indicator { display: none; }
  .nav-sep { display: none; }
  .section { padding: 1rem 0.875rem; }
  .result-card__value { font-size: 1.1rem; }
}
