/* ==========================================================================
   Modale de connexion (nouveau design)
   ========================================================================== */

/* position:fixed + inset:0 + margin:auto = centrage natif du <dialog> modal, ANCRÉ au
   viewport. (En position:relative, la modale défilait avec la page quand celle-ci avait
   un débordement horizontal sur mobile -> formulaire décalé, à recentrer à la main.) */
.authm { width: min(600px, 100% - 32px); position: fixed; inset: 0; margin: auto; height: fit-content;
         max-height: calc(100dvh - 24px); padding: clamp(28px, 4vw, 44px);
         border: 0; border-radius: var(--r-xl);
         background: var(--surface); box-shadow: var(--shadow-lg); color: var(--text); overflow: visible; }
.authm::backdrop { background: rgb(20 16 17 / .55); backdrop-filter: blur(4px); }
.authm[open] { animation: authmIn .28s var(--ease); }
@keyframes authmIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

.authm__x { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
            font-size: 1.7rem; line-height: 1; color: var(--muted); }
.authm__x:hover { background: var(--soft); color: var(--ink); }

.authm__brand { display: flex; justify-content: center; margin-bottom: 16px; }
.authm__brand img { height: 52px; width: auto; }
/* Logo d'app (store / driver) : tuile carrée arrondie, un peu plus grande */
.authm__brand img.is-appicon { height: 72px; width: 72px; border-radius: 18px; object-fit: cover;
  box-shadow: 0 10px 24px rgba(0,0,0,.16); }

.authm__form { display: flex; flex-direction: column; gap: 14px; }
.authm__form[hidden] { display: none; }
.authm__title { text-align: center; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.authm__sub { text-align: center; margin-top: -8px; color: var(--muted); font-size: .95rem; }

.authm .field { display: flex; flex-direction: column; gap: 6px; }
.authm .field > span { font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.authm .field input { height: 52px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--soft); font: inherit; color: var(--ink);
                      box-shadow: inset 0 0 0 1.5px transparent; transition: .2s; }
.authm .field input:focus { outline: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--brand); }
.authm .field__pw { position: relative; }
.authm .field__pw input { width: 100%; padding-right: 52px; }
.authm .field__eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); }
.authm .field__eye svg { width: 22px; height: 22px; }
.authm .field__eye:hover, .authm .field__eye.is-on { color: var(--brand); background: var(--brand-50); }
.authm__hint { margin-top: -8px; font-size: .8rem; color: var(--muted); }

.authm__link { align-self: flex-start; font-size: .9rem; font-weight: 600; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.authm__submit { height: 52px; font-size: 1rem; margin-top: 2px; }
.authm__submit.is-busy { opacity: .7; pointer-events: none; }
.authm__submit.is-busy::after { content: ''; width: 18px; height: 18px; margin-left: 10px; border: 2.5px solid rgb(255 255 255 / .4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }

.authm__msg { padding: 12px 14px; border-radius: var(--r-md); background: var(--brand-50); color: var(--brand); font-size: .9rem; font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand-200); }
.authm__msg.is-ok { background: #edfaf0; color: #147a3a; box-shadow: inset 0 0 0 1px #b9e6c8; }

.authm__sep { display: flex; align-items: center; gap: 14px; font-size: .85rem; color: var(--muted); }
.authm__sep::before, .authm__sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.authm__soc { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; border-radius: 999px; font-weight: 600; color: var(--ink);
              background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); transition: .2s var(--ease); }
.authm__soc:hover { box-shadow: inset 0 0 0 1.5px var(--brand-200); transform: translateY(-2px); }

.authm__foot { text-align: center; font-size: .92rem; color: var(--muted); }
.authm__foot a { font-weight: 700; color: var(--brand); }
.authm__foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Sélecteur du type de compte (Utilisateur / Chauffeur / Restaurant) */
.authm__seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 2px; }
.authm__segBtn { display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 8px; border: 1.5px solid var(--brand-200, #e3dcda); border-radius: var(--r-md, 14px);
  background: var(--surface); color: var(--muted, var(--muted)); font: inherit; font-weight: 700; font-size: .85rem;
  cursor: pointer; text-align: center; line-height: 1.2; transition: border-color .15s, background .15s, color .15s; }
.authm__segBtn:hover { border-color: var(--brand, var(--brand)); }
.authm__segBtn.is-on { background: var(--brand, var(--brand)); border-color: var(--brand, var(--brand)); color: #fff; }
@media (max-width: 420px) { .authm__segBtn { font-size: .76rem; padding: 9px 4px; } }

/* Toutes les modales de connexion gardent le thème de marque HOP! (rouge).
   (Les classes authm--rest / authm--prov sont posées par applyVariant mais n'ont
   plus d'override couleur -> on reste sur le rouge HOP par défaut.) */

/* ---------- Sélecteur d'indicatif pays (login) ---------- */
.authm .field__tel { position: relative; display: flex; align-items: stretch; gap: 8px; }
.authm .field__tel > input#amId { flex: 1 1 auto; min-width: 0; width: auto; }
/* Caché par défaut : n'apparaît que lorsque l'identifiant est un NUMÉRO (classe is-tel). */
.ccpick { display: none; align-items: center; gap: 6px; flex: 0 0 auto; height: 52px; padding: 0 12px;
  border: 0; border-radius: 14px; background: var(--soft, var(--soft)); color: var(--ink, var(--ink));
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.authm .field__tel.is-tel .ccpick { display: flex; }
.ccpick:hover { box-shadow: inset 0 0 0 1.5px var(--brand-200, #e3dcda); }
.ccpick[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px var(--brand, var(--brand)); background: var(--surface); }
.ccpick__flag { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; display: block; }
.ccpick__dial { font-size: .95rem; }
.ccpick__car { width: 14px; height: 14px; color: var(--muted, var(--muted)); flex: 0 0 auto; }

.ccpick__pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.18);
  box-shadow: 0 18px 50px rgba(0,0,0,.18), inset 0 0 0 1px var(--line, var(--line)); overflow: hidden; }
.ccpick__pop[hidden] { display: none; }
.ccpick__search { width: 100%; height: 46px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line, var(--line));
  font: inherit; background: var(--surface); color: var(--ink, var(--ink)); }
.ccpick__search:focus { outline: 0; box-shadow: inset 0 -2px 0 var(--brand, var(--brand)); }
.ccpick__list { list-style: none; margin: 0; padding: 6px; max-height: 240px; overflow-y: auto; }
.ccpick__item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.ccpick__item:hover { background: var(--soft, var(--soft)); }
.ccpick__item.is-sel { background: var(--brand-50, var(--brand-50)); }
.ccpick__iflag { width: 24px; height: 17px; object-fit: cover; border-radius: 3px; flex: 0 0 auto; }
.ccpick__iflag--none { background: var(--soft, var(--soft)); }
.ccpick__nm { flex: 1; font-size: .92rem; color: var(--ink, var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccpick__cd { font-size: .9rem; font-weight: 600; color: var(--muted, var(--muted)); }
.ccpick__empty { padding: 16px; text-align: center; color: var(--muted, var(--muted)); }

/* Mobile : modale compacte + scroll de secours pour que le bouton Google reste visible */
@media (max-width: 560px) {
  .authm { padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 20px); overflow-y: auto; }
  .authm::-webkit-scrollbar { width: 0; }
  .authm__brand { margin-bottom: 10px; }
  .authm__brand img { height: 42px; }
  .authm__brand img.is-appicon { height: 60px; width: 60px; border-radius: 15px; }
  .authm__form { gap: 11px; }
  .authm__title { font-size: 1.22rem; }
  .authm__sub { font-size: .84rem; margin-top: -6px; }
  .authm .field > span { font-size: .72rem; }
  .authm .field input { height: 46px; padding: 0 14px; }
  .authm__hint { font-size: .74rem; margin-top: -6px; }
  .authm__link { font-size: .84rem; }
  .authm__submit { height: 46px; font-size: .95rem; }
  .authm__sep { font-size: .8rem; }
  .authm__foot { font-size: .86rem; }
  .authm__x { top: 10px; right: 10px; width: 34px; height: 34px; font-size: 1.5rem; }
}
