@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

:root{
  --bg: #f6f3ff;
  --bg2:#efe9ff;
  --text:#1f2937;
  --muted:#6b7280;
  --card:#ffffff;
  --primary:#5921b3;
  --primary-600:#7c3aed;
  --ring: rgba(109,40,217,.35);
  --success:#10b981;
  --info:#3b82f6;
  --warn:#f59e0b;
  --danger:#ef4444;
}

*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0;
  color:var(--text);
  font-family:"Inter",ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  background: transparent;          /* gradient handled by ::before */
  position: relative;
}

/* Fixed background layer behind everything */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;                       /* sit behind all content */
  background: radial-gradient(1200px 600px at 20% 20%, var(--bg2), var(--bg));
}



/* FULL NAV MENU  */
/* Nav */
.nav{
  display:flex; gap:1rem; justify-content:center; align-items:center;
  padding:.75rem 1rem;
  background:rgba(255,255,255,.55);
  border-bottom:1px solid rgba(17,24,39,.06);
  backdrop-filter:blur(6px);
}
.nav a{
  color:var(--primary-600); text-decoration:none; font-weight:600;
  padding:.35rem .7rem; border-radius:.5rem;
}
.nav a:hover{ background:rgba(124,58,237,.08) }




/* lOGIN SECTION AND BOX IN THE CENTER OF THE PAGE + DASHBOARD */
/* DEAD-CENTER everything in main */
.container{
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

/* Centered brand logo above the title */
.brand-logo{
  display:block;
  margin: 0 auto 1rem;     /* center + space under */
  max-width: 120px;        /* control size; tweak as you like */
  width: 40%;
  height: auto;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.08));
}

/* Card */
.card{
  width:100%; max-width:600px;
  background:var(--card);
  border-radius:16px;
  padding:2rem;
  box-shadow: 0 18px 40px rgba(109,40,217,.12), 0 2px 8px rgba(17,24,39,.06);
}
.card h1{ margin:0 0 1rem; font-size:1.8rem; text-align:center }

/* Form */
.form-field{ margin-bottom:1rem }
label{ display:block; margin-bottom:.4rem; font-weight:700; color:#111 }
input[type="email"], input[type="password"], input[type="text"], select{
  width:100%;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:.8rem 1rem;
  outline:none;
  transition: box-shadow .15s ease, border-color .15s ease, transform .02s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.02) inset;
  font-size:1rem;
}
input:focus, select:focus{
  border-color: var(--primary-600);
  box-shadow: 0 0 0 4px var(--ring);
}
button{
  width:100%;
  padding:.9rem 1rem;
  border:0; border-radius:12px;
  background: linear-gradient(180deg, var(--primary-600), var(--primary));
  color:#fff; font-weight:700; cursor:pointer;
  box-shadow: 0 10px 18px rgba(109,40,217,.25);
  transition: transform .05s ease, filter .15s ease;
  margin-top:.25rem;
}
button:hover{ filter: brightness(1.05) }
button:active{ transform: translateY(1px) }

.muted{ color:var(--muted) }
.text-center{ text-align:center }


.badge{
  display:inline-block;
  margin-top:.5rem;
  padding:.35rem .6rem;
  border-radius:999px;
  background: rgba(124,58,237,.10);
  color: var(--primary-600);
  font-weight:700;
  font-size:.9rem;
}

/* ============================
   Login helper + pills (CTA)
   ============================ */

.login-helper {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

.login-helper-block {
  text-align: center;
}

.login-helper-title {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Boutons "pill" sous le formulaire login */
.login-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 1.4rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

/* Pill principale "S'inscrire" */
.login-pill--primary {
  background: linear-gradient(180deg, var(--primary-600), var(--primary));
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(109, 40, 217, 0.25);
}

.login-pill--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(109, 40, 217, 0.3);
}

/* Pill secondaire "Cliquez ici" */
.login-pill--outline {
  background: #ffffff;
  color: var(--primary-600);
  border: 1px solid rgba(124, 58, 237, 0.4);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.login-pill--outline:hover {
  background: rgba(124, 58, 237, 0.04);
  border-color: rgba(124, 58, 237, 0.7);
}



/*----------- FLASHES MESSAGES FOR THE FULL APP  -------------- */
/* === Flash messages: lower, animated, auto-dismiss === */
.flashes{
  position: fixed;
  top: 80px;                               /* lower than before */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  padding: 0 1rem;
  pointer-events: none;                    /* clicks go through */
}

.flash{
  pointer-events: auto;                    /* allow hover/focus on the pill */
  background: #fff;
  border: 1px solid rgba(17,24,39,.08);
  border-radius: 999px;
  padding: .75rem 1rem;
  min-width: 300px;
  max-width: 640px;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(17,24,39,.08);
  opacity: 0;
  transform: translateY(-12px) scale(.98);
  animation: flash-pop 5.2s ease forwards; /* in, hold, out */
  
}

/* Pause the auto-dismiss while hovering so users can read */
.flash:hover { animation-play-state: paused; }

/* Color accents + subtle tinted backgrounds */
.flash.success{
  border-left: 8px solid var(--success);
  background: rgba(16, 185, 129, 0.877);
  box-shadow: 0 14px 30px rgba(16,185,129,.20);
}
.flash.info{
  border-left: 8px solid var(--info);
  background: rgba(59, 131, 246, 0.671);
  box-shadow: 0 14px 30px rgba(59,130,246,.18);
}
.flash.warning{
  border-left: 8px solid var(--warn);
  background: rgba(245, 159, 11, 0.685);
  box-shadow: 0 14px 30px rgba(245,158,11,.20);
}
.flash.danger{
  border-left: 8px solid var(--danger);
  background: rgba(239, 68, 68, 0.692);
  box-shadow: 0 14px 30px rgba(239,68,68,.22);
}


/* Remove bullets/indent from flash <ul>/<li> */
.flashes{ list-style: none; margin: 0; padding: 0; }
.flashes li{ list-style: none; }
.flashes li::marker{ content: ""; }  /* extra safety */


/* Keyframes: 0–12% fade/slide in, 12–85% stay, 85–100% fade out */
@keyframes flash-pop {
  0%   { opacity: 0; transform: translateY(-12px) scale(.98); }
  12%  { opacity: 1; transform: translateY(0)     scale(1);   }
  85%  { opacity: 1; transform: translateY(0)     scale(1);   }
  100% { opacity: 0; transform: translateY(-8px)  scale(.98); }
}


/*----------- REGARDING THE NEW USER PASSWORD CHANGE FIELD -------------- */

/* Password checklist under the field */
.pw-checklist{
  list-style: none; margin: .5rem 0 0; padding: 0;
}
.pw-checklist li{
  display: flex; align-items: center; gap: .5rem;
  color: var(--muted); font-size: .85rem; line-height: 1.3;
  transition: color .15s ease;
}
.pw-checklist li::before{
  content: "✖"; font-weight: 700; opacity: .8;
}
.pw-checklist li.ok{
  color: var(--success);
}
.pw-checklist li.ok::before{
  content: "✔";
}

/* Input border feedback */
input.valid{
  border-color: var(--success) !important;
  box-shadow: 0 0 0 4px rgba(16,185,129,.25) !important;
}
input.invalid{
  border-color: #fda4a4 !important;
  box-shadow: 0 0 0 4px rgba(239,68,68,.20) !important;
}


/*----------- CSRF protection ------------ */

.form-row{ margin: .5rem 0 1rem; }
.checkbox{
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--muted); font-weight: 600;
}
.checkbox input[type="checkbox"]{
  width: 1.1rem; height: 1.1rem; accent-color: var(--primary-600);
}



/*----------- REGISTER FORM -------------- */

/* Champs (inputs + textarea identiques) */
.form_register :is(input[type="text"], input[type="email"], input[type="date"], textarea){
  width: 100%;
  box-sizing: border-box;
  background: #eff4fc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: .8rem 1rem;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease, transform .02s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.02) inset;
  font: inherit;
}

/* Placeholder identique */
.form_register :is(input[type="text"], input[type="email"], input[type="date"], textarea)::placeholder{
  color: var(--muted);
  opacity: 1;
  font-style: normal;
}

/* Focus identique */
.form_register :is(input[type="text"], input[type="email"], input[type="date"],textarea):focus{
  border-color: var(--primary-600);
  box-shadow: 0 0 0 4px var(--ring);
}

/* Textarea : comportement */
.form_register textarea{
  resize: vertical;
  min-height: 44px; /* ≈ hauteur d’un input*/
  line-height: 1.2;
}

/* Labels */
.form_register > label,
.form_register_pharmacien label,
.form_register_description label{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

/* Prénom/Nom  */
.form_register_pharmacien{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

/* Description */
.form_register_description label{ margin-bottom: 8px; }

/* Bouton Submit */
.btn_register_submit{  
  margin-top: 1.5rem;
}

/* Flashes uniquement sur /auth/login */
body.endpoint-auth-login .flashes{
  top: 40px;
}
/* Flashes uniquement sur /auth/register */
body.endpoint-auth-register .flashes{
  top: 30px;
}

/* Intro / étapes */
.form_register_intro{
  text-align: center;
  font-size: 1.1rem;
  margin-block: 2% 1%;
  color: var(--muted);
}
.form_register_steps{ color: var(--muted); }

/* Make the card a positioning context */
.card{
  position: relative;
}

/* Back button pinned to the top-left of the CARD (not the page) */
.backbtn{
  position: absolute;   /* relative to .card */
  top: 16px;
  left: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  text-decoration: none;
  background: rgba(0,0,0,0);
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, transform .02s ease;
}
.backbtn:hover{
  background: rgba(124,58,237,.08);
  border-color: #e5e7eb;
}
.backbtn:active{
  transform: translateY(1px);
}
.backbtn img{
  display: block;
  width: 48px;
  height: 48px;
}

/*----------- CARD TITLE BAR -------------- */

/* Conteneur du titre + logo */
.card-titlebar{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px; /* contrôle l'espacement global sous la barre de titre */
}

/* Espace “factice” à gauche = largeur du logo → H1 réellement centré */
.card-titlebar::before{
  content: "";
  display: block;
  width: clamp(56px, 7vw, 80px);
  height: 1px;
  flex: 0 0 auto;
}

.card-titlebar h1{
  margin: 0;
  text-align: center;
  font-size: 1.8rem;
  line-height: 1;
  flex: 1 1 auto; /* prend l'espace central */
}

/* Logo cliquable poussé à droite */
.card-titlebar .title-logo{
  display: inline-flex;
  margin-left: auto;
}

/* Taille/ajustement de l’image — plus grand et responsive */
.card-titlebar .title-logo img{
  width: clamp(64px, 7vw, 88px);
  height: clamp(64px, 7vw, 88px);
  object-fit: contain;
}

/* Old ghost button no longer used */
.btn-ghost{ display: none !important; }

.form_register_section{
  padding: 0.5rem;
}

.form_section_title{
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.25rem;
}

.form_register_ville{
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-bottom: 14px;
}

.form_register_genre{
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-bottom: 14px;
}

.form_register_contact{
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
  margin-bottom: 14px;
}


/* ---------- Responsive : mobile ---------- */
@media (max-width: 1024px){
  body.endpoint-auth-register .flashes{
    top: 30px;
    right: 210px;
    left: auto;
    transform: none;
    gap: 10px;
  }
  body.endpoint-auth-register .flash{
    min-width: 220px;
    max-width: 420px;
    padding: .5rem .75rem;
    font-size: .9rem;
    border-radius: 12px;
  }
}

@media (max-width: 768px){
  .form_register_pharmacien{ grid-template-columns: 1fr; }
  .form_register_ville{ grid-template-columns: 1fr; }
  .form_register_genre{ grid-template-columns: 1fr; }
  .form_register_contact{ grid-template-columns: 1fr; }

  /* élargir le container sur les pages sans nav (login/register) */
  body.no-nav .container{
    max-width: none;
    width: 90%;
    margin-inline: auto;
    padding-inline: 12px;
  }

  /* bouton plein largeur */
  body.no-nav .container form button{
    width: 100%;
  }

  .form_register_intro{ margin-top: 10%; }

  /* (on peut laisser ces deux lignes, mais elles seront surclassées par la règle mobile dédiée) */
  .card-titlebar{ flex-wrap: wrap; }
  .card-titlebar h1{ text-align: center; width: 100%; }

  body.endpoint-auth-register .flashes{
    top: 30px;
    right: 80px;
    left: auto;
    transform: none;
    gap: 10px;
  }
  body.endpoint-auth-register .flash{
    min-width: 220px;
    max-width: 420px;
    padding: .5rem .75rem;
    font-size: .9rem;
    border-radius: 12px;
  }
    .card-titlebar{
    flex-direction: column-reverse; /* logo au-dessus du h1 */
    align-items: center;
    text-align: center;
    margin-bottom: 16px;
  }
  .card-titlebar::before{
    display: none; /* plus besoin de l'espace factice */
  }
  .card-titlebar .title-logo{
    margin-left: 0;
  }
  .card-titlebar .title-logo img{
    width: clamp(96px, 28vw, 128px);  /* ↑ plus gros en responsive */
    height: clamp(96px, 28vw, 128px);
  }
    .card-titlebar .title-logo img{
    width: clamp(96px, 28vw, 128px);  /* ↑ plus gros en responsive */
    height: clamp(96px, 28vw, 128px);
  }
}


@media (max-width: 500px){
  body.endpoint-auth-register .flashes{
    top: 30px;
    right: 35px;
    left: auto;
    transform: none;
    gap: 10px;
  }
  body.endpoint-auth-register .flash{
    min-width: 180px;
    max-width: 420px;
    padding: .5rem .75rem;
    font-size: .9rem;
    border-radius: 12px;
  }
  .card-titlebar .title-logo img{
    width: clamp(112px, 36vw, 140px);
    height: clamp(112px, 36vw, 140px);
  }
}


/* ===== Sign-up choice modal ===== */
.signup-modal[aria-hidden="true"] { display: none; }
.signup-modal{
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
}
.signup-backdrop{
  position: absolute; inset: 0;
  background: rgba(17,24,39,.45);
  backdrop-filter: blur(2px);
}
.signup-content{
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: min(760px, 92vw);
  padding: 1.25rem 1.25rem 1.35rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  outline: none;
}
.signup-close{
  position: absolute; top: 10px; right: 10px;
  border: 0; border-radius: 999px; width: 36px; height: 36px;
  background: #efefef; cursor: pointer; font-size: 20px; font-weight: 700;
}
.signup-title{
  margin: .2rem 0 1.1rem; text-align: center;
  font-size: 1.5rem; color: var(--primary-600);
}

/* Cards grid */
.signup-grid{
  display: grid;
  grid-template-columns: 1fr 80px 1fr; /* left | OR | right on desktop */
  align-items: stretch;
  gap: 14px;
}
.signup-or{
  display: grid; place-items: center;
  font-weight: 800; color: var(--muted);
}

/* Card */
.signup-card{
  display: grid; grid-template-rows: auto auto 1fr; gap: .35rem;
  align-content: start; justify-items: center; text-align: center;
  padding: 1rem; border-radius: 16px; text-decoration: none;
  color: var(--text); background: #ffffff;
  border: 2px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(17,24,39,.06);
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.signup-card:hover{
  transform: translateY(-1px);
  border-color: var(--primary-600);
  background: rgba(124,58,237,.04);
  box-shadow: 0 12px 28px rgba(124,58,237,.18);
}
.signup-card-icon{ font-size: 2.2rem; }
.signup-card-title{ font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.signup-card-desc{ color: var(--muted); font-size: .95rem; }

/* Responsive: stack cards and show “OU” between them */
@media (max-width: 720px){
  .signup-content{ width: min(560px, 94vw); }
  .signup-grid{ grid-template-columns: 1fr; gap: 10px; }
  .signup-or{ order: 2; }
  .signup-card:nth-of-type(1){ order: 1; }
  .signup-card:nth-of-type(2){ order: 3; }
}


#signup-choice-modal[aria-hidden="false"] { display: grid !important; }

/* Hide by default */
.signup-modal { display: none; }

/* Show when targeted by hash (#signup-choice-modal) */
.signup-modal:target { 
  display: grid !important; 
}

.signup-close{
  position: absolute;
  top: 10px; right: 10px;

  /* size & shape */
  width: 36px; height: 36px;
  border-radius: 50%;

  /* center the X perfectly */
  display: grid;
  place-items: center;

  /* reset text metrics */
  line-height: 1;           /* no baseline drift */
  font-size: 18px;          /* tweak if needed */
  font-weight: 800;
  text-decoration: none;

  /* visuals */
  background: var(--primary-600);
  border: 0;
  color: #f5f5f5;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.06) inset;
}

.signup-close:hover{ filter: brightness(1.05); }
.signup-close:active{ transform: translateY(1px); }
.signup-close:focus-visible{
  outline: 0;
  box-shadow: 0 0 0 3px var(--ring);
}

/* --- MAMAN ACCOUTN CREATIOON STYLE --- */
/* --- Input with eye icon --- */
.input-with-icon{
  position: relative;      /* anchor the icon */
  display: flex;
  align-items: center;
}
.input-with-icon > input{
  width: 100%;
  padding-right: 44px;     /* space for the eye */
  box-sizing: border-box;
}
.input-with-icon .toggle-visibility{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  cursor: pointer;
  user-select: none;
  display: inline-block;   /* keep it on one line */
  pointer-events: auto;
}
.input-with-icon .toggle-visibility:focus{
  outline: 2px solid var(--primary-600);
  outline-offset: 2px;
}

/* inline field validation helper (used by script) */
.fv-msg{
  margin-top: .35rem;
  font-size: .85rem;
  color: var(--danger);
}
input.valid{ border-color: var(--success) !important; box-shadow: 0 0 0 3px rgba(16,185,129,.18) !important; }
input.invalid{ border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(239,68,68,.15) !important; }



