/* === VARIABLES DE STYLE === */
:root {
  --primary: #ff3d00;
  --primary-dark: #dd2c00;
  --secondary-blue: #1565C0;
  --bg-page: #f0f2f5;
  --bg-card: #ffffff;
  --border: #e0e0e0;
  --text-main: #333333;
  --text-muted: #666666;
  --radius: 10px;
  --shadow: 0 5px 20px rgba(0,0,0,0.08);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Open Sans', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  padding: 30px 15px;
  margin: 0;
  color: var(--text-main);
  line-height: 1.6;
}

.dha-wrapper {
  max-width: 1150px;
  margin: 0 auto;
  background: var(--bg-card);
  padding: 50px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* === EN-TÊTE === */
.dha-header {
  display: flex;
  flex-direction: column;
  margin: -50px -50px 40px -50px; /* déborde sur le padding du wrapper */
  border-bottom: 4px solid var(--primary);
}

.dha-header-logos {
  display: flex;
  width: 100%;
}

.header-logo-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px 40px;
  text-decoration: none;
  background: #fff;
  transition: background 0.2s;
}

.header-logo-link:first-child {
  border-right: 2px solid var(--border);
}

.header-logo-link:hover {
  background: #fafafa;
}

.header-logo-link img {
  max-height: 100px;
  max-width: 300px;
  width: 100%;
  object-fit: contain;
}

.logo-contact-link {
  font-size: 1em;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: underline;
  letter-spacing: 0.5px;
  transition: color 0.2s;
}

.header-logo-link:hover .logo-contact-link { color: var(--primary); }

.header-info {
  padding: 20px 50px;
  background: #f8f8f8;
  border-bottom: 1px solid var(--border);
}

.header-info h1 {
  color: var(--primary);
  margin: 0;
  font-size: 1.25em;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 800;
  text-align: center;
}

/* Styles company-column conservés au cas où */
.company-details-container { display:none; }

/* === SÉLECTEUR AGENCE === */
.agence-selector {
  background: #fff;
  border: 2px solid #ccc;
  padding: 25px;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.03);
}

.agence-selector p {
  margin-top: 0;
  font-weight: bold;
  font-size: 1.2em;
  margin-bottom: 20px;
  color: var(--text-main);
}

.radio-group-agence {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.btn-agence {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  padding: 20px;
  text-align: center;
  border: 3px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 800;
  background: #fff;
  transition: all 0.3s;
}

.btn-agence input { display: none; }

.btn-agence-dha { color: var(--text-muted); }
.btn-agence-dha:hover { border-color: var(--secondary-blue); color: var(--secondary-blue); }
.btn-agence-dha.active { border-color: var(--secondary-blue); background: #e3f2fd; color: var(--secondary-blue); box-shadow: 0 5px 15px rgba(21,101,192,0.15); }

.btn-agence-smh { color: var(--text-muted); }
.btn-agence-smh:hover { border-color: var(--secondary-blue); color: var(--secondary-blue); }
.btn-agence-smh.active { border-color: var(--secondary-blue); background: #e3f2fd; color: var(--secondary-blue); box-shadow: 0 5px 15px rgba(21,101,192,0.15); }

/* === FORMULAIRE === */
.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 30px;
  background: #fbfbfb;
}

.section-card h3 {
  margin-top: 0;
  color: #444;
  border-bottom: 3px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 25px;
  font-size: 1.4em;
  font-weight: 700;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}

label {
  font-weight: 700;
  font-size: 0.95em;
  margin-bottom: 8px;
  color: #444;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  padding: 14px 16px;
  border: 1px solid #c0c4cc;
  border-radius: 6px;
  font-size: 1em;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.3s;
  background: #fff;
  color: var(--text-main);
  -webkit-appearance: none;
  appearance: none;
}

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 fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(211,47,47,0.12);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  background: #fff;
  padding: 15px;
  border: 1px solid #c0c4cc;
  border-radius: 6px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95em;
  cursor: pointer;
  margin: 0;
  font-weight: normal;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
  width: auto;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.help-text {
  font-size: 0.85em;
  color: #78909c;
  margin-top: 5px;
}

.info-alert {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 20px;
  border-left: 6px solid #4caf50;
  border-radius: 6px;
  margin-bottom: 30px;
  font-size: 1em;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.error-text {
  color: #d32f2f;
  font-weight: bold;
  font-size: 0.9em;
  margin-top: 6px;
  display: none;
}

/* === BLOCS PORTES === */
.door-config-block {
  background: #fff;
  border: 2px solid #546e7a;
  border-radius: var(--radius);
  padding: 30px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  position: relative;
  transition: border-color 0.3s;
}

.door-config-block:hover { border-color: var(--primary); }

.door-title {
  background: #546e7a;
  color: white;
  display: inline-block;
  padding: 10px 25px;
  border-radius: 6px;
  font-weight: 800;
  margin-top: -50px;
  margin-bottom: 25px;
  font-size: 1.2em;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: background 0.3s;
}

.door-config-block:hover .door-title { background: var(--primary); }

.btn-remove {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #ffebee;
  color: #c62828;
  border: 2px solid #ffcdd2;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9em;
  transition: all 0.2s;
}

.btn-remove:hover { background: #ffcdd2; color: #b71c1c; transform: scale(1.05); }

.bloc-principal {
  background: #eceff1;
  border: 1px solid #cfd8dc;
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.bloc-principal h4 {
  margin-top: 0;
  color: #37474f;
  border-bottom: 2px solid #b0bec5;
  padding-bottom: 10px;
  font-size: 1.2em;
  font-weight: 700;
}

.bloc-secondaire {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.bloc-secondaire h4 {
  margin-top: 0;
  color: #e65100;
  border-bottom: 2px solid #ffcc80;
  padding-bottom: 10px;
  font-size: 1.2em;
  font-weight: 700;
}

.sub-title {
  font-size: 1.1em;
  color: var(--text-main);
  margin-top: 30px;
  margin-bottom: 15px;
  border-bottom: 2px dashed #ccc;
  padding-bottom: 6px;
  font-weight: 800;
  text-transform: uppercase;
}

.hidden { display: none !important; }

/* === VANTAUX SELECTOR === */
.vantaux-selector { display: flex; gap: 20px; margin-bottom: 30px; flex-wrap: wrap; }

.vantaux-btn {
  flex: 1;
  min-width: 140px;
  padding: 20px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 700;
  background: #fff;
  transition: all 0.3s;
  color: var(--text-muted);
}

.vantaux-btn:hover { border-color: #90a4ae; color: #546e7a; }
.vantaux-btn.active { border-color: #455a64; background: #eceff1; color: #263238; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.vantaux-btn input { display: none; }
.vantaux-btn .vantaux-desc { font-weight: 400; font-size: 0.8em; margin-top: 5px; display: block; }

/* === BOUTONS === */
.btn-add-door {
  background: #f1f8e9;
  color: #2e7d32;
  border: 3px dashed #a5d6a7;
  padding: 25px;
  width: 100%;
  font-size: 1.2em;
  font-weight: 800;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 40px;
}

.btn-add-door:hover { background: #c8e6c9; border-color: #66bb6a; transform: translateY(-3px); }

.submit-btn {
  background: var(--text-main);
  color: white;
  border: none;
  padding: 22px;
  width: 100%;
  font-size: 1.4em;
  font-weight: 800;
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.3s;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.submit-btn:hover { background: #000; transform: translateY(-4px); box-shadow: 0 15px 40px rgba(0,0,0,0.3); }

.footer-note {
  text-align: center;
  font-size: 0.9em;
  color: var(--text-muted);
  margin-top: 20px;
  font-weight: 400;
  padding: 0 40px;
}

/* === SÉLECTEUR SERRURERIE ===  */
.serrurerie-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.serr-btn {
  flex: 1;
  min-width: 120px;
  padding: 14px 16px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 700;
  background: #fff;
  color: var(--text-muted);
  transition: all 0.25s;
}

.serr-btn:hover { border-color: #90a4ae; color: #546e7a; }

.serr-btn.active {
  border-color: #455a64;
  background: #eceff1;
  color: #263238;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.serr-btn input { display: none; }

.serr-panel {
  background: #f4f6f8;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  padding: 20px;
  margin-top: 14px;
}

/* Sous-boutons radio dans les panneaux */
.serr-radio-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.serr-radio-btn {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 12px;
  border: 2px solid #cfd8dc;
  border-radius: 8px;
  cursor: pointer;
  background: #fff;
  text-align: center;
  transition: all 0.2s;
  color: var(--text-muted);
}

.serr-radio-btn:hover { border-color: #90a4ae; color: #546e7a; }

.serr-radio-btn.active {
  border-color: #455a64;
  background: #eceff1;
  color: #263238;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.serr-radio-btn input { display: none; }

.serr-radio-icon { font-size: 1.5em; line-height: 1; }
.serr-radio-label { font-weight: 800; font-size: 0.95em; }
.serr-radio-desc { font-size: 0.78em; color: #78909c; font-weight: 400; }
.serr-radio-btn.active .serr-radio-desc { color: #546e7a; }

/* Case à cocher stylisée */
.serr-checkbox-option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 2px solid #cfd8dc;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
  font-weight: normal;
}

.serr-checkbox-option:hover { border-color: #90a4ae; }

.serr-checkbox-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  flex-shrink: 0;
  accent-color: #455a64;
  cursor: pointer;
}

.serr-checkbox-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.95em;
}

.serr-checkbox-inner strong { color: #263238; }
.serr-checkbox-inner span { font-size: 0.85em; color: #78909c; }

@media (max-width: 600px) {
  .serrurerie-selector { flex-direction: column; }
  .serr-btn { min-width: 0; }
  .serr-radio-group { flex-direction: column; }
  .serr-radio-btn { flex-direction: row; text-align: left; justify-content: flex-start; gap: 12px; }
  .serr-radio-icon { font-size: 1.2em; }
}

/* === BANDEAU COOKIE COORDONNÉES === */
.cookie-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9em;
  color: #2e7d32;
  flex-wrap: wrap;
}

.cookie-banner button {
  background: none;
  border: 1px solid #81c784;
  color: #2e7d32;
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 700;
  transition: all 0.2s;
  white-space: nowrap;
  width: auto;
}

.cookie-banner button:hover {
  background: #ffebee;
  border-color: #e57373;
  color: #c62828;
}

.captcha-section {
  background: #f9f9f9;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 25px 30px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.captcha-label {
  font-weight: 700;
  font-size: 0.95em;
  color: #444;
  white-space: nowrap;
}

.captcha-challenge {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.captcha-question {
  background: #263238;
  color: #fff;
  font-size: 1.3em;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  user-select: none;
}

.captcha-input {
  width: 100px !important;
  text-align: center;
  font-size: 1.2em !important;
  font-weight: 700 !important;
  padding: 10px !important;
}

.captcha-refresh {
  background: none;
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 1.2em;
  color: #555;
  transition: all 0.2s;
}

.captcha-refresh:hover { border-color: var(--primary); color: var(--primary); transform: rotate(90deg); }

.captcha-error {
  color: var(--primary);
  font-weight: bold;
  font-size: 0.9em;
  width: 100%;
  display: none;
}

/* === MODAL JSON === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none !important; }

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 35px;
  max-width: 800px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}

.modal-box h2 {
  margin: 0;
  color: #2e7d32;
  font-size: 1.5em;
  border-bottom: 3px solid #c8e6c9;
  padding-bottom: 15px;
}

.modal-json-output {
  background: #1e272e;
  color: #a8d8a8;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  white-space: pre;
  overflow: auto;
  flex: 1;
  max-height: 50vh;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn-copy-json {
  background: #2e7d32;
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1em;
  transition: all 0.2s;
  flex: 1;
}

.btn-copy-json:hover { background: #1b5e20; }

.btn-close-modal {
  background: #546e7a;
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1em;
  transition: all 0.2s;
  flex: 1;
}

.btn-close-modal:hover { background: #37474f; }

/* === RESPONSIVE TABLETTE (≤ 900px) === */
@media (max-width: 900px) {
  .dha-wrapper { padding: 30px 25px; }
  .dha-header { margin: -30px -25px 30px -25px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .header-info { padding: 16px 25px; }
}

/* === RESPONSIVE SMARTPHONE (≤ 600px) === */
@media (max-width: 600px) {
  body { padding: 0; }

  .dha-wrapper {
    padding: 20px 16px;
    border-radius: 0;
    box-shadow: none;
  }

  .dha-header { margin: -20px -16px 25px -16px; }

  .header-logo-link { padding: 20px 14px; gap: 8px; }
  .header-logo-link img { max-height: 60px; }
  .logo-contact-link { font-size: 0.85em; }

  .header-info { padding: 12px 16px; }
  .header-info h1 { font-size: 0.95em; letter-spacing: 0; }

  .agence-selector { padding: 18px 14px; }
  .agence-selector p { font-size: 1em; }
  .radio-group-agence { flex-direction: column; gap: 12px; }
  .btn-agence { max-width: 100%; font-size: 1em; padding: 15px; }

  .section-card { padding: 18px 14px; }
  .section-card h3 { font-size: 1.15em; }

  .grid-2,
  .grid-3 { grid-template-columns: 1fr; gap: 0; }

  input, select, textarea { font-size: 16px; padding: 12px 14px; }

  .vantaux-selector { flex-direction: column; gap: 12px; }
  .vantaux-btn { font-size: 1em; padding: 16px; min-width: 0; }

  .door-config-block { padding: 20px 14px; padding-top: 30px; }
  .door-title { font-size: 1em; padding: 8px 16px; margin-top: -40px; margin-bottom: 20px; }
  .btn-remove { position: static; margin-bottom: 15px; width: 100%; text-align: center; }

  .bloc-principal, .bloc-secondaire { padding: 16px 14px; }

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

  .captcha-section { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px 14px; }
  .captcha-challenge { width: 100%; }
  .captcha-input { width: 90px !important; }

  .btn-add-door { font-size: 1em; padding: 18px; }

  .submit-btn { font-size: 1.15em; padding: 18px; }

  .footer-note { padding: 0 10px; font-size: 0.85em; }

  .modal-box { padding: 20px; }
  .modal-box h2 { font-size: 1.2em; }
  .modal-json-output { font-size: 0.75em; }
  .modal-actions { flex-direction: column; }
  .btn-copy-json, .btn-close-modal { width: 100%; }
}
