/* ============================================
   calcul-frais-notaire.fr — Main Stylesheet
   Mobile-first responsive design
   ============================================ */

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

:root {
  --primary: #1a365d;
  --primary-light: #2a4a7f;
  --primary-dark: #0f2440;
  --accent: #e67e22;
  --accent-hover: #cf6d17;
  --bg: #f8f9fa;
  --bg-white: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --text-dark: #1a202c;
  --border: #e2e8f0;
  --success: #38a169;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
  --max-width: 1100px;
  --transition: 0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* === Container === */
.container { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }

/* === Header === */
.site-header {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-logo:hover { color: var(--accent); }

.site-logo .logo-icon {
  background: var(--accent);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
}

/* Hamburger */
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Nav */
.main-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--primary-dark);
  padding: 0.5rem 0;
  box-shadow: var(--shadow-lg);
}

.main-nav.open { display: block; }

.main-nav ul { list-style: none; }

.main-nav a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: #fff;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.main-nav a:hover, .main-nav a.active {
  background: rgba(255,255,255,0.08);
  color: var(--accent);
}

/* === Hero === */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 2.5rem 1rem;
  text-align: center;
}

.hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.hero p {
  font-size: 1rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* === Simulator Form === */
.simulator-section { padding: 2rem 1rem; }

.simulator-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  max-width: 700px;
  margin: -3rem auto 2rem;
  position: relative;
  z-index: 10;
}

.simulator-card h2 {
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 1.25rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.checkbox-group label {
  margin-bottom: 0;
  font-weight: 500;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  margin-top: 1.25rem;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-secondary:hover { background: var(--primary-light); }

.btn-outline {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-outline:hover { background: var(--primary); color: #fff; }

/* === Results === */
.results-card {
  display: none;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  max-width: 700px;
  margin: 0 auto 2rem;
}

.results-card.visible { display: block; animation: fadeIn 0.3s ease; }

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

.result-total {
  text-align: center;
  padding: 1.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius);
  color: #fff;
  margin-bottom: 1.25rem;
}

.result-total .amount {
  font-size: 2rem;
  font-weight: 800;
  display: block;
}

.result-total .percentage {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.result-breakdown { margin-bottom: 1.25rem; }

.result-breakdown h3 {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}

.result-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.result-line:last-child { border-bottom: none; }

.result-line .label { color: var(--text-light); }
.result-line .value { font-weight: 600; color: var(--text-dark); }

.result-line.subtotal {
  font-weight: 700;
  color: var(--primary);
  border-top: 2px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.65rem;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* === Content Sections === */
.content-section {
  padding: 2.5rem 1rem;
}

.content-section:nth-child(even) { background: var(--bg-white); }

.content-section h2 {
  font-size: 1.35rem;
  color: var(--primary);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.content-section h3 {
  font-size: 1.1rem;
  color: var(--text-dark);
  margin: 1.25rem 0 0.65rem;
}

.content-section p {
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  color: var(--text);
}

.content-section ul, .content-section ol {
  margin: 0.5rem 0 1rem 1.25rem;
  font-size: 0.95rem;
}

.content-section li { margin-bottom: 0.4rem; }

/* === Tables === */
.table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--bg-white);
}

thead { background: var(--primary); color: #fff; }

th {
  padding: 0.75rem 0.65rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

td {
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:hover { background: #f7fafc; }

tbody tr:last-child td { border-bottom: none; }

td.highlight {
  font-weight: 700;
  color: var(--primary);
}

/* === Info Box / Callout === */
.info-box {
  background: #ebf8ff;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.info-box.warning {
  background: #fffbeb;
  border-left-color: var(--accent);
}

.info-box strong { color: var(--primary); }

/* === FAQ Section === */
.faq-section { margin: 1.5rem 0; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: var(--bg-white);
  border: none;
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition);
}

.faq-question:hover { background: var(--bg); }

.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item.open .faq-question::after { content: '−'; }

.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.65;
}

.faq-item.open .faq-answer { display: block; }

/* === Sticky CTA Bar (subpages) === */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary);
  padding: 0.75rem 1rem;
  text-align: center;
  z-index: 90;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.sticky-cta p {
  color: #fff;
  font-size: 0.85rem;
  margin: 0;
  display: none;
}

.sticky-cta .btn-cta {
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background var(--transition);
}

.sticky-cta .btn-cta:hover { background: var(--accent-hover); }

/* === Breadcrumb === */
.breadcrumb {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-light);
  max-width: var(--max-width);
  margin: 0 auto;
}

.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 0.35rem; }

/* === Cards grid === */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.card h3 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.card .card-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

/* === Footer === */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.7);
  padding: 2rem 1rem;
  margin-top: 2rem;
  font-size: 0.85rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.footer-col h4 {
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.footer-col ul { list-style: none; }

.footer-col a {
  color: rgba(255,255,255,0.65);
  display: block;
  padding: 0.25rem 0;
  font-size: 0.825rem;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 0.8rem;
}

.footer-bottom p { margin-bottom: 0.25rem; }

/* === Page header (subpages) === */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 2rem 1rem;
  text-align: center;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 0.95rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* subpage body needs bottom padding for sticky CTA */
.has-sticky-cta { padding-bottom: 4rem; }

/* === TABLET (min-width: 640px) === */
@media (min-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .page-header h1 { font-size: 1.75rem; }

  .simulator-card { padding: 2rem; margin-top: -3.5rem; }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .cards-grid { grid-template-columns: 1fr 1fr; }

  .result-actions { flex-direction: row; }
  .result-actions .btn-primary,
  .result-actions .btn-secondary { flex: 1; }

  .footer-grid { grid-template-columns: 1fr 1fr; }

  .sticky-cta p { display: block; }

  table { font-size: 0.9rem; }
  th, td { padding: 0.75rem; }
}

/* === DESKTOP (min-width: 960px) === */
@media (min-width: 960px) {
  .hero { padding: 3.5rem 1rem; }
  .hero h1 { font-size: 2.4rem; }
  .hero p { font-size: 1.1rem; }

  .page-header { padding: 2.5rem 1rem; }
  .page-header h1 { font-size: 2rem; }

  .nav-toggle { display: none; }

  .main-nav {
    display: flex;
    position: static;
    background: none;
    padding: 0;
    box-shadow: none;
  }

  .main-nav ul {
    display: flex;
    gap: 0.25rem;
  }

  .main-nav a {
    padding: 0.5rem 0.85rem;
    border-bottom: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
  }

  .main-nav a:hover, .main-nav a.active {
    background: rgba(255,255,255,0.12);
  }

  .content-section { padding: 3rem 1rem; }
  .content-section h2 { font-size: 1.5rem; }

  .cards-grid { grid-template-columns: 1fr 1fr 1fr; }

  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }

  .simulator-card { margin-top: -4rem; }
}

/* === Print === */
@media print {
  .site-header, .site-footer, .sticky-cta, .nav-toggle, .btn-primary, .btn-secondary { display: none; }
  body { background: #fff; }
  .simulator-card, .results-card { box-shadow: none; border: 1px solid #ddd; }
}
