/* ============================================================
   VARIABLES GLOBALES
   ============================================================ */
:root {
  --bleu-fonce: #0e2d44;
  --bleu-hover: #174a6e;
  --bleu-clair: #e7f1f8;
  --jaune: #f2ac33;
  --jaune-hover: #e3991f;
  --gris: #f2f4f7;
  --gris-fonce: #6b7280;
  --gris-mid: #d0d5dd;
  --blanc: #fff;
  --rouge: #d64545;

  --radius: 12px;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);

  --transition: all 0.25s ease;
  --maxw: 1200px;

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial;
}

/* ===================================================================
   RESET BASIQUE
   =================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--gris);
  color: var(--bleu-fonce);
  line-height: 1.5;
  min-height: 100vh;
}

/* ===================================================================
   HEADER
   =================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: white;
  padding: 18px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  z-index: 1000;
}


.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--bleu-fonce);
}

.site-sub {
  color: var(--gris-fonce);
  font-size: 14px;
}

.site-logo {
  height: 62px;
  object-fit: contain;
}

/* ===================================================================
   LAYOUT PRINCIPAL
   =================================================================== */
.form-layout {
  max-width: var(--maxw);
  margin: 24px auto;
  padding: 0 22px;
  display: flex;
  gap: 32px;
}

/* Résumé latéral (desktop only) */
.summary-panel {
  width: 280px;
  background: white;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  height: max-content;
  position: sticky;
  top: 20px;
}

.summary-panel h3 {
  margin-bottom: 10px;
  font-weight: 700;
}

.desktop-only {
  display: block;
}

@media (max-width: 960px) {
  .desktop-only {
    display: none;
  }
}

/* FORMULAIRE PRINCIPAL */
form {
  flex: 1;
}

body {
  padding-top: 98px;
}

/* ===================================================================
   BARRE DE PROGRESSION
   =================================================================== */
.progress-wrapper {
  margin-bottom: 28px;
}

.progress-bar {
  width: 100%;
  background: var(--gris-mid);
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--jaune);
  transition: width .3s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.step-label {
  font-size: 13px;
  color: var(--gris-fonce);
  font-weight: 600;
}

body {
  padding-top: 98px;
}

/* ===================================================================
   SECTIONS DU FORMULAIRE
   =================================================================== */
.form-step {
  background: white;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: var(--transition);
}

.form-step.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.step-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}

.step-desc {
  color: var(--gris-fonce);
  margin-bottom: 18px;
}

/* Champs */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-grid .full {
  grid-column: span 2;
}

.form-field label {
  font-weight: 600;
  margin-bottom: 6px;
  display: inline-block;
}

input[type="text"],
input[type="email"],
input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gris-mid);
  background: white;
  font-size: 16px;
  transition: var(--transition);
}

input:focus,
select:focus {
  border-color: var(--bleu-hover);
  box-shadow: 0 0 0 3px rgba(23, 74, 110, 0.12);
  outline: none;
}

body {
  padding-top: 98px;
}

/* ===================================================================
   LOTS (corps de métier)
   =================================================================== */
.lot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 14px;
}

.lot-card {
  background: var(--blanc);
  padding: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-radius: var(--radius);
  border: 1.5px solid var(--gris-mid);
  cursor: pointer;
  transition: var(--transition);
}

.lot-card:hover {
  border-color: var(--bleu-hover);
  box-shadow: var(--shadow);
}

.lot-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--jaune);
}

.lot-icon {
  width: 22px;
  height: 22px;
}

body {
  padding-top: 98px;
}

/* ===================================================================
   QUESTIONS
   =================================================================== */
.lot-question-block {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.lot-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.question-row {
  padding: 12px 0;
  border-bottom: 1px solid rgba(14,45,68,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.q-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Radios stylées */
.radio-pill {
  display: inline-flex;
  background: var(--gris);
  padding: 6px 12px;
  border-radius: 22px;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 1px solid var(--gris-mid);
}

.radio-pill:hover {
  background: var(--bleu-clair);
}

.radio-pill input {
  accent-color: var(--jaune);
}

/* Quantités */
.quantities-block {
  margin-top: 10px;
  padding-left: 10px;
  display: none;
  animation: fadeSlide .25s ease forwards;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.qty-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.qty-label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-input {
  width: 120px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1.5px solid var(--gris-mid);
}

body {
  padding-top: 98px;
}

/* ================================
   Alignements des OUI / NON
   ================================ */

.question-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid #eef1f5;
}

.q-text {
  font-size: 15px;
  line-height: 1.5;
  color: #0b253a;
}

/* Groupe Oui / Non */
.q-actions {
  display: flex;
  gap: 10px;
}

/* Boutons radio stylés */
.radio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid #d0d7e2;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 500;
  color: #0b253a;
  transition: all 0.2s ease;
}

/* Cacher le radio natif */
.radio-pill input[type="radio"] {
  display: none;
}

/* Hover */
.radio-pill:hover {
  border-color: #f2a900;
}

/* État sélectionné */
.radio-pill input[type="radio"]:checked + span,
.radio-pill:has(input[type="radio"]:checked) {
  background: #fff6e5;
  border-color: #f2a900;
  color: #0b253a;
}

/* Responsive */
@media (max-width: 768px) {
  .question-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .q-actions {
    justify-content: flex-start;
  }
}


/* ===================================================================
   NAVIGATION "SUIVANT / PRÉCÉDENT"
   =================================================================== */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
}

.btn-primary,
.btn-secondary {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

.btn-primary {
  background: var(--bleu-fonce);
  color: white;
}

.btn-primary:hover {
  background: var(--bleu-hover);
}

.btn-secondary {
  background: var(--gris-mid);
  color: var(--bleu-fonce);
}

.btn-secondary:hover {
  background: #c7ccd3;
}

.hidden {
  display: none !important;
}

/* ===================================================================
   PAGE QUOTE.HTML (Version Finale Corrigée & Unifiée)
   =================================================================== */

.quote-page,
.quote-container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 40px 22px 80px;
}

.quote-page h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 40px 0 25px 0;
    color: var(--bleu-fonce);
}

/* --- BANNIÈRE ESTIMATION (RECTANGLE BLEU) --- */
.estimation-hero-wrapper {
    margin: 20px 0 50px 0;
    width: 100%;
}

.estimation-hero {
    background-color: var(--bleu-fonce);
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    color: var(--blanc);
    box-shadow: 0 12px 30px rgba(14, 45, 68, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.estimation-title {
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.estimation-range {
    font-size: 42px;
    font-weight: 900;
    color: var(--jaune);
    letter-spacing: -1px;
    line-height: 1;
}

.estimation-range span {
    color: rgba(255, 255, 255, 0.4);
    margin: 0 10px;
}

.estimation-duration {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- CARTES DE LOTS (DÉTAILS BLANCS) --- */
.lot-card-block {
    background: white;
    padding: 35px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 35px;
    border: 1px solid rgba(14, 45, 68, 0.05);
}

.lot-card-block h3 {
    font-size: 20px;
    color: var(--bleu-fonce);
    border-left: 5px solid var(--jaune);
    padding-left: 15px;
    margin-bottom: 25px;
}

/* --- TABLEAUX ÉPURÉS & LIGNES PERSONNALISÉES --- */
table.devis-table {
    width: 100%;
    border-collapse: collapse;
}

table.devis-table th {
    background: #f8fafc;
    color: var(--gris-fonce);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 12px;
    border-bottom: 2px solid var(--gris-mid);
}

table.devis-table td {
    padding: 18px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 15px;
}

/* Gestion de la largeur des colonnes */
table.devis-table th:nth-child(1), 
table.devis-table td:nth-child(1) { width: 30%; } /* Poste */

table.devis-table th:nth-child(2), 
table.devis-table td:nth-child(2) { min-width: 130px; } /* Quantité (ÉLARGIE) */

table.devis-table th:nth-child(3), 
table.devis-table td:nth-child(3) { width: 80px; }  /* Unité */

table.devis-table th:nth-child(4), 
table.devis-table td:nth-child(4) { min-width: 100px; } /* Durée */

table.devis-table th:nth-child(5), 
table.devis-table td:nth-child(5) { width: 100px; } /* Jours */

table.devis-table th:nth-child(6), 
table.devis-table td:nth-child(6) { min-width: 150px; white-space: nowrap; } /* Coût */

/* Styles des champs de saisie (Inputs) */
.custom-line-input, 
.qty-input, 
.unit-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid var(--gris-mid);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: var(--transition);
}

/* Bordure jaune spécifique quand on est en mode édition pour les lignes ajoutées */
.line-row.new-line .custom-line-input {
    border-color: var(--jaune);
}

.custom-line-input:focus {
    border-color: var(--bleu-fonce);
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 45, 68, 0.1);
}

/* --- BOUTONS D'ACTION --- */
.action-row {
    margin-top: 25px;
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.btn-add-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #27ae60 !important; /* Vert pro */
    color: white !important;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-custom:hover {
    background: #219150 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.2);
}

/* --- ANIMATIONS --- */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.line-row.new-line {
    animation: slideIn 0.3s ease-out forwards;
    background-color: #fffdf5; /* Fond légèrement jauni pour les nouvelles lignes */
}

/* Responsive */
@media (max-width: 960px) {
    table.devis-table { display: block; overflow-x: auto; }
    .estimation-range { font-size: 32px; }
    .lot-card-block { padding: 20px; }
}