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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --red: #ef4444;
  --green: #10b981;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
a.logo { text-decoration: none; }

/* ── HEADER & NAV ── */
header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 200; }
header .container { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.logo { font-size: 1.2rem; font-weight: 700; color: var(--text); flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.logo span { color: var(--primary); }
.logo-icon { width: 28px; height: 28px; flex-shrink: 0; }

#main-nav { display: flex; align-items: center; gap: 2px; }

/* Dropdown items */
.nav-dropdown { position: relative; }
.nav-btn {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 0.85rem; font-weight: 500; color: var(--text-muted);
  padding: 6px 10px; border-radius: 8px; display: flex; align-items: center; gap: 4px;
  transition: all 0.15s; white-space: nowrap;
}
.nav-btn:hover, .nav-btn.active { background: var(--primary-light); color: var(--primary); }
.caret { font-size: 0.7rem; transition: transform 0.2s; }
.nav-dropdown.open .caret { transform: rotate(180deg); }

.dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0;
  padding-top: 8px; /* espace cliquable entre bouton et menu */
  z-index: 300; min-width: 220px;
}
.dropdown-menu-inner {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 6px;
}
/* Ouverture au hover CSS — fiable et sans gap */
.nav-dropdown:hover .dropdown-menu { display: block; }
.caret { transition: transform 0.2s; }
.nav-dropdown:hover .caret { transform: rotate(180deg); }

.dropdown-menu a {
  display: block; text-decoration: none; color: var(--text); font-size: 0.875rem;
  padding: 9px 12px; border-radius: 8px; transition: background 0.1s; white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--bg); }
.dropdown-menu a.active { color: var(--primary); background: var(--primary-light); font-weight: 500; }

/* Direct nav link */
#main-nav > a {
  text-decoration: none; font-size: 0.85rem; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}
.nav-accueil { color: var(--text-muted) !important; font-weight: 500 !important; }
.nav-accueil:hover, .nav-accueil.active { background: var(--primary-light); color: var(--primary) !important; }
.nav-highlight { background: #fef9c3; color: #92400e !important; }
.nav-highlight:hover { background: #fef08a; }
.nav-highlight.active { background: #fde68a; }

/* Hamburger */
.menu-toggle {
  display: none; background: none; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; color: var(--text);
}

/* Mobile nav */
.mobile-nav { display: none; background: var(--white); border-bottom: 1px solid var(--border); padding: 8px 20px 16px; }
.mobile-nav.open { display: block; }
.mobile-section { margin-bottom: 12px; }
.mobile-section-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 8px 12px 4px; }
.mobile-nav a { display: block; text-decoration: none; color: var(--text); font-size: 0.875rem; padding: 8px 12px; border-radius: 8px; }
.mobile-nav a:hover { background: var(--bg); }
.mobile-templates { margin-top: 8px; background: #fef9c3 !important; color: #92400e !important; font-weight: 600; }

/* ── HERO ── */
.hero { background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%); color: white; padding: 36px 0 32px; }
.hero-badge { display: inline-block; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: 20px; padding: 4px 14px; font-size: 0.8rem; font-weight: 500; margin-bottom: 12px; }
.hero h1 { font-size: clamp(1.4rem, 3.5vw, 2.1rem); font-weight: 700; margin-bottom: 8px; }
.hero p { font-size: 0.95rem; opacity: 0.85; max-width: 680px; }

/* ── AD STRIP (PUB 1) ── */
.ad-strip { background: var(--white); border-bottom: 1px solid var(--border); padding: 10px 0; }
.ad-leaderboard { height: 90px; width: 100%; max-width: 728px; margin: 0 auto; }

/* ── PAGE GRID ── */
.calculator-section { padding: 28px 0 32px; }
.page-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 32px; align-items: start; }
.main-col { min-width: 0; }
.calculator-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; margin-bottom: 20px; }

/* ── CARDS ── */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 18px; }
.card h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 12px; }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.04em; }
.statut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.statut-btn, .toggle-btn { padding: 7px 8px; border: 1.5px solid var(--border); background: var(--white); border-radius: 7px; font-size: 0.8rem; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: all 0.15s; font-family: inherit; text-align: center; }
.statut-btn:hover, .toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.statut-btn.active, .toggle-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.statut-btn:last-child { grid-column: 1 / -1; }

.input-group { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; transition: border-color 0.15s; }
.input-group:focus-within { border-color: var(--primary); }
.input-group input, .input-group select { flex: 1; border: none; outline: none; padding: 10px 12px; font-size: 0.95rem; font-family: inherit; color: var(--text); background: var(--white); min-width: 0; }
.unit { padding: 10px 12px; background: var(--bg); color: var(--text-muted); font-size: 0.82rem; font-weight: 500; border-left: 1.5px solid var(--border); white-space: nowrap; }

.mois-grid, .toggle-group { display: flex; gap: 5px; flex-wrap: wrap; }
.mois-btn { padding: 6px 10px; border: 1.5px solid var(--border); background: var(--white); border-radius: 7px; font-size: 0.78rem; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: all 0.15s; font-family: inherit; }
.mois-btn:hover { border-color: var(--primary); color: var(--primary); }
.mois-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

input[type="range"] { width: 100%; height: 4px; appearance: none; background: var(--border); border-radius: 4px; outline: none; cursor: pointer; margin: 8px 0 4px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.range-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--text-muted); }

/* ── RESULTS ── */
.results-panel { display: flex; flex-direction: column; gap: 14px; }
.results-grid-top { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.result-block { text-align: center; padding: 16px 10px; }
.result-block.highlight { background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%); color: white; }
.result-period { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.result-block.highlight .result-period { color: rgba(255,255,255,0.75); }
.result-amount { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -0.5px; margin-bottom: 4px; }
.result-block.highlight .result-amount { color: white; font-size: 1.9rem; }
.result-brut { font-size: 0.72rem; color: var(--text-muted); }
.result-block.highlight .result-brut { color: rgba(255,255,255,0.65); }

.result-single { text-align: center; background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%); color: white; padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.result-single .result-label { font-size: 0.82rem; opacity: 0.8; margin-bottom: 8px; }
.result-single .result-value { font-size: 2.6rem; font-weight: 700; letter-spacing: -1px; }
.result-single .result-sub { font-size: 0.85rem; opacity: 0.75; margin-top: 6px; }

.detail-line { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.detail-line:last-child { border-bottom: none; padding-bottom: 0; }
.detail-line.deduction span:last-child { color: var(--red); font-weight: 500; }
.detail-line.total { font-weight: 600; }
.detail-line.total span:last-child { color: var(--primary); }
.detail-line.total.green span:last-child { color: var(--green); }
.detail-line .info { font-size: 0.75rem; color: var(--text-muted); }

.badge { display: inline-block; font-size: 0.65rem; background: var(--primary-light); color: var(--primary); padding: 2px 7px; border-radius: 20px; font-weight: 500; margin-left: 6px; }

.annuel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.annuel-item { background: var(--bg); border-radius: 8px; padding: 11px; }
.annuel-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 3px; }
.annuel-value { font-size: 1.05rem; font-weight: 700; }
.mois-info { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }

/* CTA Templates */
.cta-templates { display: flex; align-items: center; gap: 14px; background: #fefce8; border: 1px solid #fde68a; }
.cta-icon { font-size: 1.6rem; flex-shrink: 0; }
.cta-templates strong { font-size: 0.875rem; display: block; margin-bottom: 2px; }
.cta-templates p { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.btn-cta { margin-left: auto; white-space: nowrap; background: var(--primary); color: white; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; flex-shrink: 0; }
.btn-cta:hover { background: var(--primary-dark); }

/* ── AD UNITS ── */
.ad-label { display: block; font-size: 0.62rem; color: var(--text-muted); text-align: center; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.ad-unit { background: #f3f4f6; border: 1px dashed #d1d5db; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.78rem; }
.ad-mid { height: 90px; width: 100%; margin-bottom: 28px; }
.ad-inarticle { height: 120px; width: 100%; margin: 16px 0; }
.ad-sidebar { display: flex; flex-direction: column; gap: 20px; }
.ad-sidebar-top { height: 250px; width: 100%; }
.ad-sidebar-bot { height: 250px; width: 100%; }
.sticky-ad { position: sticky; top: 80px; }

/* Sidebar links */
.sidebar-links { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.sidebar-links-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }
.sidebar-links a { display: block; text-decoration: none; color: var(--text); font-size: 0.85rem; padding: 8px 0; border-bottom: 1px solid var(--border); transition: color 0.15s; }
.sidebar-links a:last-child { border-bottom: none; }
.sidebar-links a:hover { color: var(--primary); }

/* ── SEO SECTION (pleine largeur) ── */
.seo-section { background: var(--white); border-top: 1px solid var(--border); padding: 52px 0; margin-top: 12px; }
.seo-section h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 14px; }
.seo-section p { color: var(--text-muted); margin-bottom: 10px; font-size: 0.9rem; max-width: 800px; }
.faq { margin-top: 28px; display: flex; flex-direction: column; gap: 8px; max-width: 800px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.faq-question { padding: 13px 16px; font-weight: 600; font-size: 0.875rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.faq-question::after { content: '+'; font-size: 1.1rem; color: var(--primary); font-weight: 400; flex-shrink: 0; margin-left: 8px; }
.faq-item.open .faq-question::after { content: '−'; }
.faq-answer { display: none; padding: 0 16px 13px; color: var(--text-muted); font-size: 0.875rem; }
.faq-item.open .faq-answer { display: block; }

/* ── TEMPLATES PAGE ── */
.templates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-top: 28px; }
.template-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.template-card-icon { font-size: 2rem; }
.template-card h3 { font-size: 1rem; font-weight: 600; }
.template-card p { font-size: 0.85rem; color: var(--text-muted); flex: 1; }
.template-card-actions { display: flex; gap: 8px; }
.btn-secondary { padding: 8px 14px; border: 1.5px solid var(--border); background: var(--white); border-radius: 8px; font-size: 0.82rem; font-weight: 500; cursor: pointer; color: var(--text); font-family: inherit; text-decoration: none; transition: all 0.15s; }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { padding: 8px 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit; text-decoration: none; transition: background 0.15s; }
.btn-primary:hover { background: var(--primary-dark); }

.template-content-area { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 20px; font-size: 0.875rem; line-height: 1.8; white-space: pre-wrap; font-family: Georgia, serif; color: var(--text); margin-top: 16px; max-height: 400px; overflow-y: auto; }
.copy-success { color: var(--green); font-size: 0.8rem; font-weight: 500; display: none; }
.copy-success.show { display: block; }

/* ── COOKIE BANNER ── */
#cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: var(--text); color: rgba(255,255,255,0.9);
  padding: 14px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; flex-wrap: wrap;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}
.cookie-text { font-size: 0.84rem; line-height: 1.5; flex: 1; min-width: 200px; }
.cookie-text a { color: #93c5fd; }
.cookie-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-btn {
  padding: 8px 18px; border-radius: 8px; font-size: 0.82rem;
  font-weight: 600; cursor: pointer; border: none; font-family: inherit;
  transition: opacity 0.15s;
}
.cookie-btn:hover { opacity: 0.85; }
.cookie-refuse { background: rgba(255,255,255,0.15); color: white; }
.cookie-accept { background: var(--primary); color: white; }

/* ── FOOTER ── */
footer { background: var(--text); color: rgba(255,255,255,0.6); padding: 28px 0; margin-top: 48px; }
footer .container { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; flex-wrap: wrap; gap: 12px; }
footer nav { display: flex; gap: 20px; }
footer nav a { color: rgba(255,255,255,0.5); text-decoration: none; }
footer nav a:hover { color: white; }

/* ── HOMEPAGE TOOLS ── */
.hero-stats { display: flex; gap: 28px; margin-top: 22px; flex-wrap: wrap; }
.hero-stat { font-size: 0.875rem; opacity: 0.85; }
.hero-stat strong { font-size: 1.5rem; font-weight: 700; display: block; line-height: 1.1; }

.tools-section { padding: 36px 0 52px; }
.tools-category { margin-bottom: 40px; }
.tools-category-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tool-tile {
  display: flex; flex-direction: column; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; text-decoration: none; color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  border: 1.5px solid transparent; position: relative; overflow: hidden;
}
.tool-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.10); border-color: var(--primary); }
.tool-tile-new::after {
  content: 'Nouveau'; position: absolute; top: 10px; right: 10px;
  background: #dcfce7; color: #166534; font-size: 0.6rem; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em;
}
.tool-icon { font-size: 1.9rem; margin-bottom: 10px; line-height: 1; }
.tool-name { font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.tool-desc { font-size: 0.77rem; color: var(--text-muted); flex: 1; line-height: 1.55; margin-bottom: 14px; }
.tool-arrow { font-size: 0.78rem; font-weight: 600; color: var(--primary); }

/* ── FORM SELECT FULL WIDTH ── */
.select-full {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.9rem; font-family: inherit;
  color: var(--text); background: var(--white); outline: none;
  cursor: pointer; transition: border-color 0.15s;
}
.select-full:focus { border-color: var(--primary); }

/* ── RESPONSIVE ── */
@media (max-width: 1050px) {
  .page-grid { grid-template-columns: 1fr; }
  .ad-sidebar { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .ad-sidebar-top, .ad-sidebar-bot { height: 90px; }
  .sticky-ad { position: static; }
  .sidebar-links { display: none; }
}
@media (max-width: 760px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .results-grid-top { grid-template-columns: 1fr 1fr 1fr; }
  #main-nav { display: none; }
  .menu-toggle { display: block; }
}
@media (max-width: 500px) {
  .results-grid-top { grid-template-columns: 1fr; }
  .result-block.highlight { order: -1; }
  .annuel-grid { grid-template-columns: 1fr 1fr; }
  .cta-templates { flex-wrap: wrap; }
  .btn-cta { margin-left: 0; width: 100%; text-align: center; padding: 10px; }
  .hero h1 { font-size: 1.4rem; }
  .template-card-actions { flex-wrap: wrap; }
}
