/* Typography */
html {
  font-size: 1rem;
}

:root {
  --q-primary: #c74224; /* accessible primary */
  --q-primary-ink: #9a2f19; /* darker hover/active */
}

body {
  font-family: "Inter", "Poppins", system-ui, -apple-system, Segoe UI, Roboto,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  color: #1f2937; 
}

/* Head */
h1 {
  text-align: center;
  margin-top: 150px; /* rely on body padding-top for fixed nav offset */
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 1.8rem;
}

.quest h2 {
  font-weight: 600;
  font-size: 1.25rem;
}

/* Multi-select */
.ms {
  position: relative;
  max-width: 520px;
  margin: 6px 0 14px;
}

.ms__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid #b8b8b8; 
  border-radius: 6px;
  background: #fff;
  color: #333; 
  cursor: pointer;
  min-height: 38px;
  font: inherit;
  font-size: 0.9rem;
}


.ms__toggle:hover {
  border-color: #9aa3af;
  background-color: #f9fafb;
  color: #1f2937;
}

.ms__label {
  font-weight: 600;
}

.ms__count {
  color: #555;
  font-size: 0.9em;
}

.ms__toggle:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.ms__toggle.is-placeholder,
.ms__toggle.is-placeholder .ms__label,
.ms__toggle.is-placeholder .ms__count {
  color: #6b7280;
}

.ms__toggle.is-placeholder:hover {
  border-color: #9aa3af;
  background-color: #f9fafb;
}

.ms__toggle.is-placeholder:hover,
.ms__toggle.is-placeholder:hover .ms__label,
.ms__toggle.is-placeholder:hover .ms__count {
  color: #1f2937;
}

.ms__menu {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid #bdbdbd; 
  border-radius: 6px;
  margin-top: 4px;
  max-height: 260px;
  overflow: auto;
  width: 100%;
  padding: 8px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* Actions: Tout sélectionner / Tout désélectionner */
.ms__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 0 10px;
}

.ms__action {
  appearance: none;
  -webkit-appearance: none;
  background: var(--q-primary);
  color: #ffffff;
  border: 1px solid var(--q-primary);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    filter 0.15s ease;
}

.ms__action:hover {
  background: var(--q-primary-ink);
  border-color: var(--q-primary-ink);
}

.ms__action:focus-visible {
  outline: 3px solid var(--q-primary-ink); /* stronger focus ring */
  outline-offset: 2px;
}

.ms__option {
  display: block;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
}

/* Couleur de sélection des cases à cocher */
.ms__option input[type="checkbox"] {
  accent-color: var(--q-primary); /* darker accent for better contrast */
}

.ms__option:hover {
  background: #f7f7f7;
}

select.ms--hidden {
  position: absolute !important;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Form controls */
select {
  width: auto;
  margin: 5px;
  padding: 6px 8px;
  font-size: 1rem;
}

option {
  font-size: 1rem;
}

.quest {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 75vh;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 16px;
}

.ms__search {
  width: 100%;
  padding: 8px 34px 8px 36px; 
  border: 1px solid #b9c0c7; 
  border-radius: 8px;
  margin-bottom: 8px;
  font: inherit;
  position: sticky;
  top: 0;
  background: #ffffff; 
  z-index: 1;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  background-repeat: no-repeat;
  background-position: 10px 50%;
  background-size: 16px 16px;
}

.ms__search:hover {
  border-color: #9aa3af; 
}
.ms__search:focus {
  border-color: var(--q-primary);
  box-shadow: 0 0 0 3px rgba(199, 66, 36, 0.35); 
  background-color: #fff;
}
.ms__search::placeholder {
  color: #6b7280; 
}

/* Native clear button (WebKit/Blink) */
.ms__search::-webkit-search-cancel-button {
  cursor: pointer;
}

@media (prefers-contrast: more) {
  .ms__search {
    border-width: 2px;
    box-shadow: none;
    outline: 3px solid #111; 
  }
  .ms__toggle {
    border-width: 2px;
  }
}

form button {
  margin-top: 15px;
  padding: 15px 25px;
  font-size: 1rem;
  font-weight: 600;
  background-color: var(--q-primary); 
  color: #ffffff; 
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

form button:hover {
  background-color: var(--q-primary-ink); 
}


form button:focus-visible {
  outline: 3px solid #111111;
  outline-offset: 3px;
}


form button:active {
  background-color: var(--q-primary-ink);
}


form button:disabled,
form button[disabled] {
  background-color: #e5e7eb; 
  color: #374151;            
  border: 1px solid #9aa3af; 
  cursor: not-allowed;
  opacity: 1;                
}


.quest form {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  padding: 20px;
}

.quest h2 {
  width: 100%;
  max-width: 780px;
  margin: 12px 0 8px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Tablette */
@media (max-width: 900px) {
  .quest {
    padding: 14px;
  }
}

/* téléphone */
@media (max-width: 600px) {
  h1 {
    margin-top: 0;
    font-size: 1.5rem;
  }
  .quest {
    padding: 12px;
  }
  .ms {
    max-width: none;
    width: 100%;
  }
  .ms__menu {
    max-height: 60vh;
  }
  form button {
    width: 100%;
  }
}

@media (prefers-contrast: more) {
  form button {
    border: 2px solid #111111;
    outline: 3px solid #111111;
    outline-offset: 3px;
  }
}
