/* =============================================
   SEROO — Formulaire Nouvelle Réparation
   Design : dark pro / accent orange
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

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

/* ---------- Variables ---------- */
:root {
  --bg:        #0f1117;
  --surface:   #181c26;
  --card:      #1e2330;
  --border:    #2b3145;
  --accent:    #e07020;
  --accent-h:  #f08030;
  --text:      #e8eaf0;
  --muted:     #8891aa;
  --danger:    #e05050;
  --success:   #3ecf6e;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.45);
  --font-ui:   'DM Sans', sans-serif;
  --font-head: 'Space Grotesk', sans-serif;
  --t:         0.2s ease;
  /* readonly colors */
  --readonly-bg:   #1e2330;
  --readonly-text: #e07020;
}

/* ---- THEME CLAIR ---- */
body.theme-light {
  --bg:        #f0f2f7;
  --surface:   #ffffff;
  --card:      #ffffff;
  --border:    #d0d5e8;
  --text:      #1a1f2e;
  --muted:     #6b7491;
  --shadow:    0 4px 24px rgba(0,0,0,0.10);
  --readonly-bg:   #fff4ec;
  --readonly-text: #c85a00;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

body > a img {
  display: block;
  margin: 24px auto 0;
  height: 52px;
  filter: brightness(1.1);
}

h1 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.5px;
  margin: 18px 0 4px;
  color: #fff;
}

h2 {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Recherche client ---------- */
#searchClient {
  display: block;
  margin: 24px auto 0;
  width: min(460px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 18px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
#searchClient::placeholder { color: var(--muted); }
#searchClient:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,112,32,0.18);
}

#resultats {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 90vw);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1000;
  max-height: 340px;
  overflow-y: auto;
}
#resultats .client-result {
  display: block;
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  width: 100%;
  color: var(--text);
  transition: background var(--t);
}
#resultats .client-result:last-child { border-bottom: none; }
#resultats .client-result:hover {
  background: rgba(224,112,32,0.12);
  color: #fff;
}

/* ---------- Formulaire ---------- */
form {
  width: min(1100px, 96vw);
  margin: 28px auto 60px;
  background: transparent;
  padding: 0;
}

/* Neutraliser display:inline-block du HTML original */
form div  { display: block; margin: 0 0 10px 0; }
form span { display: block; }

/* ---------- Grille cartes ---------- */
#all {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  border: none;
  background: transparent;
  padding: 0;
  margin-bottom: 20px;
}

/* Toutes les cartes */
#all > span,
span#adresse,
span#Commentaires,
span#Prestation {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow: var(--shadow);
  width: 100% !important;
  margin: 0 !important;
}
span#adresse,
span#Commentaires,
span#Prestation {
  margin-top: 20px !important;
  overflow: hidden;
}

/* ---------- Blocs .c100 (hors Prestation) ---------- */
.c100 {
  width: 100%;
  text-align: left;
  position: relative;
  margin-bottom: 14px;
}
.c100 label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

/* ---------- Champs dans .c100 et span#adresse ---------- */
.c100 input,
.c100 select,
.c100 textarea,
span#adresse input,
span#adresse select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
  appearance: none;
}
.c100 select,
span#adresse select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238891aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* Textarea : toujours pleine largeur */
textarea {
  width: 100% !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color var(--t), box-shadow var(--t);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

/* Focus / hover */
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(224,112,32,0.18);
}
input:hover, textarea:hover, select:hover {
  border-color: #3d4560;
}

/* Readonly : toujours orange visible */
input[readonly] {
  color: var(--accent) !important;
  -webkit-text-fill-color: var(--accent) !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  background: rgba(224,112,32,0.10) !important;
  border-color: rgba(224,112,32,0.30) !important;
  cursor: default;
}

/* ==============================================
   SECTION #Prestation
   Champs de base (sans width:100% forcé)
   ============================================== */
#Prestation input:not([readonly]),
#Prestation select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  -webkit-appearance: none;
  appearance: none;
}
#Prestation select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238891aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* Border-radius et padding sur les readonly */
#Prestation input[readonly] {
  border-radius: 10px !important;
  padding: 9px 13px !important;
  padding-block: 9px !important;
  padding-inline: 13px !important;
}

/* Neutraliser margin-left:-44px inline sur les labels recap */
#Prestation label[style*="margin-left"] {
  margin-left: 0 !important;
}

/* --- FORFAIT 1 à 4 : label + select + "Tarif:" + input readonly --- */
#Prestation > div:has(select[name^="presta_ordi"]) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  margin-bottom: 10px !important;
}
#Prestation > div:has(select[name^="presta_ordi"]) > label:first-child {
  flex: 0 0 210px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  margin: 0;
}
#Prestation > div:has(select[name^="presta_ordi"]) > select {
  flex: 1 1 auto;
  min-width: 0;
  width: auto !important;
}
#Prestation > div:has(select[name^="presta_ordi"]) > label:not(:first-child) {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin: 0;
}
#Prestation > div:has(select[name^="presta_ordi"]) > input {
  flex: 0 0 110px !important;
  width: 110px !important;
}

/* --- AUTRE PRESTATION : label + input texte + "Tarif:" + input --- */
#Prestation > div:has(input[name="presta_ordi5"]),
#Prestation > div:has(input[name="presta_divers"]) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  margin-bottom: 10px !important;
}
#Prestation > div:has(input[name="presta_ordi5"]) > label:first-child,
#Prestation > div:has(input[name="presta_divers"]) > label:first-child {
  flex: 0 0 210px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  margin: 0;
}
#Prestation > div:has(input[name="presta_ordi5"]) > input[name="presta_ordi5"],
#Prestation > div:has(input[name="presta_divers"]) > input[name="presta_divers"] {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0;
}
#Prestation > div:has(input[name="presta_ordi5"]) > label:not(:first-child),
#Prestation > div:has(input[name="presta_divers"]) > label:not(:first-child) {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  margin: 0;
}
#Prestation > div:has(input[name="presta_ordi5"]) > input[name="prix_ordi5"],
#Prestation > div:has(input[name="presta_divers"]) > input[name="prix_divers"] {
  flex: 0 0 110px !important;
  width: 110px !important;
}

/* Readonly dans #Prestation : APRES toutes les regles input
   pour gagner en specificite et ecraser color:var(--text) */
#Prestation input[readonly],
#Prestation input#prix_ordi1,
#Prestation input#prix_ordi2,
#Prestation input#prix_ordi3,
#Prestation input#prix_ordi4,
#Prestation input#total1,
#Prestation input#prixfinal {
  all: unset !important;
  display: block !important;
  box-sizing: border-box !important;
  color: var(--readonly-text) !important;
  -webkit-text-fill-color: var(--readonly-text) !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  font-family: 'DM Sans', sans-serif !important;
  font-size: 14px !important;
  background: var(--readonly-bg) !important;
  background-color: var(--readonly-bg) !important;
  border: 1px solid rgba(224,112,32,0.35) !important;
  border-radius: 10px !important;
  padding: 9px 13px !important;
  cursor: default !important;
  outline: none !important;
  transition: background var(--t), color var(--t) !important;
}

/* --- TOTAL (tarif appliqué) --- */
#Prestation div:has(> input[name="total1"]) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  margin-top: 20px !important;
  margin-bottom: 10px !important;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
#Prestation div:has(> input[name="total1"]) label {
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#Prestation div:has(> input[name="total1"]) input {
  flex: 0 0 120px !important;
  width: 120px !important;
}

/* --- BONUS QUALIREPAR --- */
#Prestation div:has(> select#qualirepar) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  margin-bottom: 10px !important;
}
#Prestation div:has(> select#qualirepar) label {
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#Prestation div:has(> select#qualirepar) select {
  flex: 0 0 120px !important;
  width: 120px !important;
}

/* --- PRIX FINAL --- */
#Prestation div:has(> input[name="prixfinal"]) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  margin-bottom: 10px !important;
}
#Prestation div:has(> input[name="prixfinal"]) label {
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#Prestation div:has(> input[name="prixfinal"]) input {
  flex: 0 0 120px !important;
  width: 120px !important;
}

/* --- RÉGLÉ --- */
#Prestation .c100:has(> input#Regler) {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100% !important;
  margin-bottom: 10px !important;
}
#Prestation .c100:has(> input#Regler) > label {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0;
}
#Prestation .c100:has(> input#Regler) > input {
  flex: 1 1 auto !important;
  width: auto !important;
}

/* ---------- Email status ---------- */
.status-icon {
  font-size: 16px;
  vertical-align: middle;
  margin-left: 8px;
}
.status-icon.valid   { color: var(--success); }
.status-icon.invalid { color: var(--danger); }

.error-message {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ---------- Alerte rouge ---------- */
b[style*="FF0000"] {
  display: inline-block;
  background: rgba(224,80,80,0.12);
  border: 1px solid rgba(224,80,80,0.3);
  color: #ff7070 !important;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---------- Boutons (autres pages) ---------- */
.c100 button,
#submit button {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  padding: 13px 28px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(224,112,32,0.35);
  transition: background var(--t), box-shadow var(--t), transform 0.1s ease;
  margin: 4px 6px 4px 0;
}
.c100 button:hover,
#submit button:hover {
  background: var(--accent-h);
  box-shadow: 0 6px 28px rgba(224,112,32,0.55);
  transform: translateY(-1px);
}
.c100 button:active,
#submit button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(224,112,32,0.3);
}

/* ---------- Submit ---------- */
#submit {
  text-align: center !important;
  margin-top: 28px;
}
input[type="submit"] {
  display: inline-block;
  width: auto !important;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius);
  padding: 13px 48px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(224,112,32,0.35);
  transition: background var(--t), box-shadow var(--t), transform 0.1s ease;
}
input[type="submit"]:hover {
  background: var(--accent-h);
  box-shadow: 0 6px 28px rgba(224,112,32,0.55);
  transform: translateY(-1px);
}
input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(224,112,32,0.3);
}

/* ---------- Bouton thème ---------- */
#theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  transition: background var(--t), color var(--t), border-color var(--t), box-shadow var(--t);
}
#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#theme-toggle .icon { font-size: 16px; }

/* Adaptations thème clair sur éléments non-variables */
body.theme-light form { background: transparent; }
body.theme-light #all > span,
body.theme-light span#adresse,
body.theme-light span#Commentaires,
body.theme-light span#Prestation { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
body.theme-light #searchClient { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
body.theme-light h1 { color: #1a1f2e; }
body.theme-light h2 { color: var(--accent); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  #all { grid-template-columns: 1fr; }
  h1   { font-size: 1.5rem; }
  #Prestation > div:has(select[name^="presta_ordi"]) > label:first-child,
  #Prestation > div:has(input[name="presta_ordi5"])  > label:first-child,
  #Prestation > div:has(input[name="presta_divers"]) > label:first-child {
    flex: 0 0 120px;
  }
}
