/* Projet 1-1-420 – Nirvana : finitions visuelles du portail gestion.nirvanahp.com (10 règles de design)
   Chargé après les styles du site (module du portail). Règles déjà respectées, donc rien à ajouter ici :
   5 (icônes SVG des accès rapides : trait d'environ 2,1 px pour des libellés gras de 16 px),
   6 (aucun carrousel), 9 (pages plein écran d'Odoo déjà en svh, aucun 100vh dans le portail),
   10 (les photos des pièces et des machines reconstruites n'ont pas de fond blanc). */

/* 3. Palette des surfaces du mode sombre en OKLCH : même teinte, paliers de clarté réguliers.
      s1 = carte actuelle (#172230) ; s2 = survolée (#1e2b3b, déjà utilisée) ; s3 = active. */
:root {
  --nhp-s1: oklch(24.9% .031 254);
  --nhp-s2: oklch(28.5% .035 254);
  --nhp-s3: oklch(32% .039 254);
  /* 2. Bordures semi-transparentes, qui se fondent dans tous les fonds */
  --nhp-bord: rgb(13 58 99 / .2);
  --nhp-bord-doux: rgb(13 58 99 / .12);
  --nhp-bord-sombre: rgb(142 197 255 / .24);
}

/* 1. Coins imbriqués : cadre AHRI de 12 px avec 0,4 rem de marge → image à 12 px − 0,4 rem. */
.nhp-ahri img,
html[data-nhp-theme="dark"] .nhp-ahri img { border-radius: calc(12px - .4rem); }

/* 2. Bordures en couleur semi-transparente (mode clair). Le focus et les erreurs gardent leurs couleurs. */
html:not([data-nhp-theme="dark"]) #wrapwrap :is(.form-control, .form-select):not(:focus):not(.is-invalid):not(.is-valid),
html:not([data-nhp-theme="dark"]) #wrapwrap .nhp-page .nhp-field :is(input, select, textarea):not(:focus):not(.is-invalid),
html:not([data-nhp-theme="dark"]) #wrapwrap .nhp-suivi-service .nhp-suivi-ligne input:not(:focus),
html:not([data-nhp-theme="dark"]) .nhp-ag-liste {
  border-color: var(--nhp-bord);
}
html:not([data-nhp-theme="dark"]) #wrapwrap .nhp-page .nhp-terms,
html:not([data-nhp-theme="dark"]) #wrapwrap .nhp-page .nhp-photos img {
  border-color: var(--nhp-bord-doux);
}
html:not([data-nhp-theme="dark"]) .nhp-connexion-panier { border-color: rgb(29 106 165 / .28); }
html:not([data-nhp-theme="dark"]) .nhp-formulaire .nhp-verif-serie.nhp-verif-ok { border-color: rgb(25 135 84 / .3); }
html:not([data-nhp-theme="dark"]) .nhp-formulaire .nhp-verif-serie.nhp-verif-inconnu { border-color: rgb(255 193 7 / .45); }
html:not([data-nhp-theme="dark"]) .nhp-formulaire .nhp-verif-serie.nhp-verif-refus { border-color: rgb(220 53 69 / .3); }

/* 2. Mêmes bordures en mode sombre (remplacent #33445a, #3a4152 et #2a4a6e, opaques). */
html[data-nhp-theme="dark"] #wrapwrap :is(.form-control, .form-select, textarea, select, .input-group-text):not(:focus):not(.is-invalid):not(.is-valid),
html[data-nhp-theme="dark"] #wrapwrap .nhp-page .nhp-terms,
html[data-nhp-theme="dark"] #wrapwrap .nhp-page .nhp-places gmp-place-autocomplete,
html[data-nhp-theme="dark"] .nhp-ag-liste,
html[data-nhp-theme="dark"] .nhp-ag-liste .nhp-ag-item,
html[data-nhp-theme="dark"] .nhp-connexion-panier {
  border-color: var(--nhp-bord-sombre) !important;
}

/* 4. Dégradé de l'entête des produits interpolé en OKLCH (mode clair ; le sombre est uni). */
@supports (background: linear-gradient(in oklch, red, blue)) {
  .nhp-portail .nhp-portail-produit-entete { background: linear-gradient(135deg in oklch, #0d3a63, #1d6aa5); }
}

/* 7. Bouton Mode sombre / Mode clair : l'icône qui arrive sort d'un léger flou. */
@keyframes nhp-icone-floue { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
html:not([data-nhp-theme="dark"]) .nhp-theme-bouton .nhp-vers-sombre i,
html[data-nhp-theme="dark"] .nhp-theme-bouton .nhp-vers-clair i {
  animation: nhp-icone-floue .3s ease;
}

/* 8. Mode sombre : au survol, une surface plus claire plutôt qu'une ombre noire (invisible). */
html[data-nhp-theme="dark"] .nhp-portail .nhp-portail-bouton,
html[data-nhp-theme="dark"] .nhp-installateurs .nhp-installateur,
html[data-nhp-theme="dark"] .nhp-formulaire .nhp-usa-carte {
  transition: background-color .2s ease, border-color .2s ease;
}
html[data-nhp-theme="dark"] .nhp-portail .nhp-portail-bouton:hover,
html[data-nhp-theme="dark"] .nhp-installateurs .nhp-installateur:hover,
html[data-nhp-theme="dark"] .nhp-formulaire .nhp-usa-carte:hover {
  background-color: var(--nhp-s2) !important;
  box-shadow: none !important;
}
html[data-nhp-theme="dark"] .nhp-installateurs .nhp-installateur.nhp-actif {
  background-color: var(--nhp-s3) !important;
  box-shadow: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .nhp-theme-bouton i { animation: none !important; }
}
