/* ============================================================================
 * form-controls.css — Polissage des contrôles de formulaire (toute l'app).
 *   1. Bouton « Parcourir » des champs fichier → look bouton app.
 *   2. Champs nombre : flèches natives masquées, remplacées par un stepper
 *      intégré et discret (▲▼) — voir public/number-stepper.js.
 * Additif et réversible (retirer les <link>/<script> dans head.ejs).
 * ========================================================================== */

/* --- 1. Champs fichier : bouton « Parcourir » ------------------------------ */
input[type="file"] {
  font-size: 0.88rem;
  color: var(--label-secondary, #6b7280);
  max-width: 100%;
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  margin-right: 0.85rem;
  border: 1.5px solid var(--separator-opaque, #c6c6c8);
  border-radius: 10px;
  background: var(--bg-secondary, #fff);
  color: var(--label-primary, #111);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  border-color: var(--tint, #007aff);
  color: var(--tint, #007aff);
  background: var(--fill-tertiary, rgba(0,0,0,0.03));
}
input[type="file"]::file-selector-button:active { transform: scale(0.97); }

/* --- 2. Champs nombre : masque les flèches natives ------------------------- */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Stepper personnalisé injecté par number-stepper.js */
.app-stepper { position: relative; display: block; width: 100%; }
.app-stepper > input[type="number"] { width: 100%; padding-right: 2rem; box-sizing: border-box; }
.app-stepper-btns {
  position: absolute;
  top: 6px; bottom: 6px; right: 6px;
  display: flex; flex-direction: column;
  width: 22px; gap: 2px;
}
.app-stepper-btns button {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  border: none; padding: 0; margin: 0;
  background: var(--fill-secondary, rgba(0,0,0,0.04));
  color: var(--label-secondary, #6b7280);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
}
.app-stepper-btns button:hover {
  background: var(--tint, #007aff);
  color: #fff;
}
.app-stepper-btns button:active { transform: scale(0.9); }
.app-stepper-btns svg { width: 9px; height: 9px; display: block; }

/* --- 3. Champ fichier habillé (file-input.js) : texte français garanti ----- */
.app-filefield {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  max-width: 100%;
}
.app-filefield > input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.app-filefield-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border: 1.5px solid var(--separator-opaque, #c6c6c8);
  border-radius: 10px;
  background: var(--bg-secondary, #fff);
  color: var(--label-primary, #111);
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.app-filefield-name {
  font-size: 0.88rem;
  color: var(--label-secondary, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.app-filefield.has-file .app-filefield-name { color: var(--label-primary, #111); }
.app-filefield:hover .app-filefield-btn {
  border-color: var(--tint, #007aff);
  color: var(--tint, #007aff);
  background: var(--fill-tertiary, rgba(0,0,0,0.03));
}
.app-filefield:focus-within .app-filefield-btn {
  border-color: var(--tint, #007aff);
  box-shadow: 0 0 0 4px var(--fill-primary, rgba(0,122,255,0.15));
}

/* --- 4. Selects « nus » : chevron maison partout ---------------------------
   Les selects hors conteneurs stylés (.app-form, .app-modal…) gardaient la
   flèche système. :where() = spécificité (0,0,1) : toute règle composant
   existante continue de gagner sur padding/fond. Listes ([multiple]/[size])
   exclues : elles doivent rester natives. -------------------------------- */
select:where(:not([multiple]):not([size])) {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.2rem;
}
