/* ============ Facture Gratuite — styles principaux ============ */
:root {
  --primary: #1a56db;
  --primary-dark: #123fa8;
  --accent: #0ea5e9;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e3e8f0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(20, 40, 90, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

a { color: var(--primary); }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { font-size: 1.35rem; text-decoration: none; color: var(--text); }
.main-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.main-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
}
.main-nav a:hover { background: #eef3fd; }
.main-nav a.active { background: var(--primary); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #1a56db 0%, #0ea5e9 100%);
  color: #fff;
  text-align: center;
  padding: 56px 0;
}
.hero h1 { margin: 0 0 8px; font-size: 2.2rem; }
.hero .tagline { font-size: 1.2rem; opacity: .95; margin: 0 0 16px; }
.hero-points { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; font-weight: 500; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  font-family: inherit;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .55; cursor: wait; }
.btn-secondary { background: #e8eefb; color: var(--primary-dark); }
.btn-secondary:hover { background: #dbe6fa; }
.btn-danger { background: #fdeaea; color: #b42323; }
.btn-danger:hover { background: #fbdcdc; }
.btn-lg { font-size: 1.15rem; padding: 14px 30px; }
.btn-small { padding: 8px 14px; font-size: .9rem; }
.hero .btn-primary { background: #fff; color: var(--primary-dark); }
.hero .btn-primary:hover { background: #f0f4ff; }

/* ---------- Emplacements publicitaires (espaces réservés) ---------- */
.ad-slot {
  border: 2px dashed #b0b7c3;
  background: #f4f6f9;
  color: #8a93a3;
  text-align: center;
  padding: 28px 12px;
  margin: 24px auto;
  max-width: 970px;
  border-radius: 8px;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.sidebar .ad-slot { margin: 0 0 20px; max-width: none; }

/* ---------- Outil de facturation ---------- */
.builder-section { padding: 36px 0 10px; }
.builder-section h2 { margin-top: 0; }
.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 28px;
  align-items: start;
}

fieldset {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 0 18px;
  box-shadow: var(--shadow);
}
legend { font-weight: 700; padding: 0 8px; font-size: 1.05rem; }
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 5px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  background: #fbfcfe;
  color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(26,86,219,.35); border-color: var(--primary); }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; margin: 4px 0 0; }

.line-item {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fbfcfe;
}
.line-item-grid { display: grid; grid-template-columns: 1fr 84px 110px; gap: 10px; }
.line-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.line-item-head strong { font-size: .95rem; }
.line-item-amount { text-align: right; font-weight: 700; padding-top: 4px; }
.btn-remove {
  background: #fdeaea; color: #b42323; border: none; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-size: .85rem; font-weight: 600;
}

.tax-option {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: #fbfcfe;
}
.tax-option input[type="checkbox"] { width: auto; accent-color: var(--primary); }
.tax-option .tax-name { font-weight: 700; }
.tax-option .tax-rate-wrap { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.tax-option input[type="number"] { width: 86px; padding: 6px 8px; text-align: right; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.autosave-note { color: var(--muted); font-size: .88rem; }

/* ---------- Aperçu de la facture ---------- */
.preview-label { font-weight: 700; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; font-size: .85rem; letter-spacing: .05em; }
.preview-col { position: sticky; top: 76px; }

.invoice-paper {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 6px 30px rgba(20, 40, 90, .15);
  color: #1f2937;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 40px 42px;
  min-height: 640px;
}
.invoice-header {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--primary);
}
.inv-brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.inv-brand-detail { white-space: pre-line; color: #667085; font-size: .78rem; line-height: 1.6; margin-top: 6px; }
.inv-title { text-align: right; }
.inv-title strong { display: block; font-size: 2rem; line-height: 1; letter-spacing: .02em; }
.inv-title span { color: var(--primary); font-weight: 800; font-size: .9rem; }
.inv-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
  padding: 24px 0 28px;
}
.inv-kicker {
  color: #98a2b3;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.inv-client-name { font-size: 1rem; font-weight: 700; }
.inv-client-detail { white-space: pre-line; color: #667085; font-size: .78rem; line-height: 1.55; margin-top: 4px; }
.inv-meta-list { display: grid; gap: 6px; align-content: start; }
.inv-meta-pair { display: flex; justify-content: space-between; gap: 20px; font-size: .8rem; }
.inv-meta-pair span:first-child { color: #7a8494; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.invoice-table th {
  padding: 8px 6px;
  border-bottom: 2px solid #d6dce8;
  color: #667085;
  font-size: .65rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
}
.invoice-table td { padding: 11px 6px; border-bottom: 1px solid #e8edf4; vertical-align: top; }
.invoice-table th:nth-child(n+2), .invoice-table td:nth-child(n+2) { text-align: right; }
.inv-item-name { font-weight: 600; }
.inv-totals { width: min(300px, 70%); margin: 22px 0 0 auto; }
.inv-total-row { display: flex; justify-content: space-between; gap: 20px; padding: 4px 0; font-size: .85rem; }
.inv-grand-total { border-top: 2px solid var(--primary); margin-top: 8px; padding-top: 10px; font-weight: 800; font-size: 1.15rem; }
.inv-grand-total span:last-child { color: var(--primary); }
.inv-note {
  margin-top: 42px;
  padding-top: 16px;
  border-top: 1px solid #e8edf4;
  color: #667085;
  font-size: .75rem;
  white-space: pre-line;
}
.inv-note strong { color: var(--text); display: block; margin-bottom: 4px; font-size: .8rem; }
.inv-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
  color: #98a2b3;
  font-size: .68rem;
}

/* ---------- Sections de présentation ---------- */
.features { padding: 30px 0 6px; }
.features h2, .section-title { text-align: center; }
.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 22px; }
.feature-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.feature-card .icon { font-size: 1.7rem; }
.feature-card h3 { margin: 8px 0 6px; font-size: 1.02rem; }
.feature-card p { margin: 0; color: #374151; font-size: .95rem; }
.guide-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px; }

/* ---------- FAQ ---------- */
.faq { padding: 40px 0 50px; }
.faq h2 { text-align: center; }
.faq details {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.faq summary { font-weight: 700; cursor: pointer; }

/* ---------- Pages de contenu ---------- */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; padding: 30px 0 50px; }
.article { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 34px; box-shadow: var(--shadow); }
.article h1 { margin-top: 0; }
.article h2 { margin-top: 30px; color: var(--primary-dark); }
.article .lead { font-size: 1.12rem; color: #374151; }
.article table.data { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .95rem; }
.article table.data th, .article table.data td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.article table.data th { background: #eef3fd; }
.example-card { background: #f8fafd; border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; margin-bottom: 18px; }
.example-card h3 { margin-top: 0; }
.calc-card { background: #eef3fd; border: 1px solid #c7d6f8; border-radius: 8px; padding: 18px 20px; margin: 18px 0; }
.calc-card h3 { margin-top: 0; color: var(--primary-dark); }
.cta-box { background: linear-gradient(135deg, #1a56db, #0ea5e9); color: #fff; border-radius: var(--radius); padding: 26px; text-align: center; margin: 30px 0; }
.cta-box h2 { color: #fff; margin-top: 0; }
.cta-box .btn-primary { background: #fff; color: var(--primary-dark); }
.step-list { counter-reset: etape; list-style: none; padding: 0; }
.step-list li { counter-increment: etape; position: relative; padding-left: 52px; margin-bottom: 20px; }
.step-list li::before {
  content: counter(etape);
  position: absolute; left: 0; top: 0;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.step-list h3 { margin: 4px 0 4px; }
.step-list p { margin: 0; }

/* ---------- Formulaire de contact ---------- */
.contact-form .field { margin-bottom: 14px; }
.form-note {
  display: none;
  background: #eafaf0; border: 1px solid #8fd6a4; color: #14532d;
  border-radius: 8px; padding: 12px 16px; margin-top: 14px; font-size: .95rem;
}
.form-note.show { display: block; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px;
  transform: translate(-50%, 18px); z-index: 90;
  max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 8px;
  background: #111c33; color: #fff; font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.site-footer { background: #111c33; color: #cbd5e1; margin-top: 20px; }
.footer-inner { padding-top: 30px; padding-bottom: 24px; display: grid; gap: 14px; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: #e2e8f0; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.copyright { font-size: .85rem; color: #94a3b8; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .builder-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .article-layout { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .guide-links { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 1.7rem; }
  .field-row, .line-item-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .invoice-paper { padding: 24px 20px; }
  .inv-meta { grid-template-columns: 1fr; gap: 16px; }
  .inv-totals { width: 85%; }
  .article { padding: 22px; }
}

/* ---------- Impression : seule la facture ---------- */
@media print {
  .site-header, .site-footer, .hero, .ad-slot, .editor-col, .no-print { display: none !important; }
  body { background: #fff; }
  .builder-grid { display: block; }
  .preview-col { position: static; }
  .invoice-paper { box-shadow: none; }
}
