/* =========================================================
   DENTORIA — page de connexion (animée)
   ========================================================= */
:root {
  --l-from: #0b50dc;
  --l-to: #07236f;
  --l-primary: #2563eb;
  --l-text: #0f1e3d;
  --l-muted: #64748b;
  --l-border: #e3e9f3;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--l-text); background: #fff; -webkit-font-smoothing: antialiased; }

.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }

/* ---------- Panneau gauche ---------- */
.l-side {
  position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(70% 50% at 85% 10%, rgba(56, 189, 248, .35), transparent 60%),
    linear-gradient(160deg, var(--l-from) 0%, var(--l-to) 100%);
  padding: clamp(28px, 4vw, 52px); display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
}
.l-side > * { position: relative; z-index: 2; }

.l-brand { display: flex; align-items: center; gap: 14px; animation: fadeDown .7s ease both; }
.l-brand .logo-tile {
  width: 92px; height: 92px; border-radius: 24px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 0 0 0 rgba(125, 190, 255, .55); animation: pulse 3.2s ease-out infinite;
}
.l-brand .logo-tile img { width: 76px; height: 76px; object-fit: contain; filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(160, 210, 255, .8)); }
.l-brand strong { display: block; font-size: 28px; font-weight: 800; letter-spacing: .2px; }
.l-brand small { display: block; font-size: 13px; color: #bcd5ff; margin-top: 2px; }

.l-hero h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.12; font-weight: 800; letter-spacing: -.5px; animation: fadeUp .8s .15s ease both; }
.l-hero h1 span {
  background: linear-gradient(90deg, #9fd0ff, #7dd3fc, #c4e3ff, #9fd0ff); background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 5s linear infinite;
}
.l-hero p { margin-top: 16px; max-width: 460px; color: #d3e2ff; line-height: 1.6; font-size: 16px; animation: fadeUp .8s .3s ease both; }

.l-feats { list-style: none; padding: 0; display: grid; gap: 12px; }
.l-feats li { display: flex; align-items: center; gap: 14px; font-weight: 500; color: #eaf2ff; opacity: 0; animation: fadeUp .6s ease forwards; }
.l-feats li:nth-child(1) { animation-delay: .45s; }
.l-feats li:nth-child(2) { animation-delay: .6s; }
.l-feats li:nth-child(3) { animation-delay: .75s; }
.l-feats li:nth-child(4) { animation-delay: .9s; }
.l-feats .tick { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .15); }
.l-feats .tick svg { width: 17px; height: 17px; stroke: #fff; }

/* Emblème en filigrane */
.l-emblem {
  position: absolute !important; z-index: 1 !important; inset-inline-end: -130px; bottom: 16%; width: min(460px, 66%);
  opacity: .14; pointer-events: none; filter: brightness(0) invert(1) drop-shadow(0 10px 40px rgba(125, 190, 255, .5));
  animation: floaty 9s ease-in-out infinite;
}
.l-glow { position: absolute !important; z-index: 0 !important; border-radius: 50%; filter: blur(60px); pointer-events: none; }
.l-glow.g1 { width: 340px; height: 340px; left: -120px; bottom: -120px; background: rgba(56, 189, 248, .35); animation: drift 12s ease-in-out infinite; }
.l-glow.g2 { width: 260px; height: 260px; right: 10%; top: -80px; background: rgba(147, 197, 253, .3); animation: drift 15s ease-in-out infinite reverse; }

.spark {
  position: absolute !important; z-index: 1 !important; width: 16px; height: 16px; background: #fff; opacity: 0;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: twinkle 3.6s ease-in-out infinite;
}
.spark.s1 { top: 22%; inset-inline-end: 14%; }
.spark.s2 { top: 48%; inset-inline-end: 36%; width: 11px; height: 11px; animation-delay: 1.2s; }
.spark.s3 { top: 70%; inset-inline-end: 10%; width: 13px; height: 13px; animation-delay: 2.1s; }
.spark.s4 { top: 14%; inset-inline-start: 46%; width: 10px; height: 10px; animation-delay: .6s; }

.bubble { position: absolute !important; z-index: 1 !important; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .05); animation: rise linear infinite; }
.bubble.b1 { width: 18px; height: 18px; left: 12%; bottom: -30px; animation-duration: 14s; }
.bubble.b2 { width: 30px; height: 30px; left: 32%; bottom: -40px; animation-duration: 19s; animation-delay: 3s; }
.bubble.b3 { width: 14px; height: 14px; left: 58%; bottom: -30px; animation-duration: 16s; animation-delay: 6s; }
.bubble.b4 { width: 24px; height: 24px; left: 78%; bottom: -40px; animation-duration: 21s; animation-delay: 1s; }

/* ---------- Panneau droit ---------- */
.l-main { position: relative; display: flex; align-items: center; justify-content: center; padding: 32px 24px; background: #f5f8fd; }
.l-box { width: 100%; max-width: 400px; text-align: center; animation: fadeUp .8s .2s ease both; }
.r-logo { display: block; width: 150px; height: auto; margin: -14px auto 4px; } /* logo Dentis complet (vertical) */
.l-box h2 { font-size: 28px; font-weight: 800; letter-spacing: -.4px; margin-top: 10px; color: #0a1633; }
.l-box .sub { color: var(--l-muted); margin: 8px 0 28px; font-size: 14px; }

.msg { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; font-weight: 500; text-align: start; animation: shake .45s ease; }
.msg svg { width: 18px; height: 18px; flex: none; }
.msg-error { background: #fff0f0; color: #c62828; border: 1px solid #ffd3d3; }
.msg-ok { background: #ecfbf1; color: #15803d; border: 1px solid #c9f0d6; animation: fadeUp .4s ease; }
.msg-info { background: #eaf2ff; color: #1e3a8a; border: 1px solid #cfe0ff; animation: fadeUp .35s ease; }
.msg[hidden] { display: none; }

.field { margin-bottom: 16px; text-align: start; }
.field label, .lbl-row label { display: block; font-size: 13px; font-weight: 600; color: #0a1633; }
.field > label { margin-bottom: 7px; }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.lbl-row a { font-size: 13px; font-weight: 500; color: var(--l-primary); text-decoration: none; }
.lbl-row a:hover { text-decoration: underline; }
.control { position: relative; }
.control > svg.lead { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #7b889f; transition: color .2s; pointer-events: none; }
.control input {
  width: 100%; height: 46px; padding-block: 0; padding-inline: 42px 44px; border-radius: 9px; border: 1px solid #dde5f0;
  background: #fff; font: inherit; font-size: 14px; color: var(--l-text); transition: border-color .2s, box-shadow .2s;
}
.control input::placeholder { color: #9aa6bb; }
.control input:focus { outline: none; border-color: var(--l-primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .13); }
.control:focus-within > svg.lead { color: var(--l-primary); }
.eye { position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; color: #46526b; cursor: pointer; transition: background .2s, color .2s; }
.eye:hover { background: #eef2fa; color: var(--l-primary); }
.eye svg { width: 18px; height: 18px; }

.row { display: flex; align-items: center; margin: 4px 0 18px; text-align: start; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; color: #1b2c52; }
.check input { width: 16px; height: 16px; accent-color: var(--l-primary); }

.btn-login {
  position: relative; overflow: hidden; width: 100%; height: 46px; border: 0; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; font: inherit; font-weight: 700; font-size: 14.5px;
  background: linear-gradient(90deg, #1245b5 0%, #2563eb 55%, #3a9bf5 100%);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .30); transition: transform .2s, box-shadow .2s;
}
.btn-login::after { content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); transform: skewX(-20deg); animation: sweep 4s 1.2s ease-in-out infinite; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(37, 99, 235, .42); }
.btn-login:active { transform: translateY(0); }
.btn-login .arrow { width: 17px; height: 17px; transition: transform .2s; }
[dir="rtl"] .btn-login .arrow { transform: scaleX(-1); }
.btn-login:hover .arrow { transform: translateX(4px); }
[dir="rtl"] .btn-login:hover .arrow { transform: scaleX(-1) translateX(4px); }
.btn-login .spin { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-login.loading { pointer-events: none; opacity: .92; }
.btn-login.loading .arrow { display: none; }
.btn-login.loading .spin { display: block; }

.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0 18px; color: #8b97ad; font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #e3e9f3; }
.noacc { font-size: 13px; color: #46526b; }
.noacc a { color: var(--l-primary); font-weight: 500; text-decoration: none; }
.noacc a:hover { text-decoration: underline; }

.by-pill { display: inline-flex; align-items: center; gap: 7px; margin-top: 26px; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid #e3e9f3; font-size: 11.5px; color: #46526b; }
.by-pill svg { width: 12px; height: 12px; color: var(--l-primary); flex: none; }
.by-pill b { color: var(--l-primary); font-weight: 700; }
.legal { margin-top: 12px; font-size: 11.5px; color: #8b97ad; line-height: 1.7; }
.legal a { color: #8b97ad; text-decoration: none; }
.legal a:hover { color: var(--l-primary); text-decoration: underline; }

/* Sélecteur de langue (espace patient) */
.l-lang { position: absolute; top: 22px; inset-inline-end: 24px; z-index: 5; }
.lang-pill { direction: ltr; display: inline-flex; background: #fff; border: 1px solid #dde5f0; border-radius: 999px; padding: 3px; box-shadow: 0 2px 8px rgba(15, 30, 61, .05); }
.lang-pill a { padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; text-decoration: none; color: #46526b; }
.lang-pill a.on { background: var(--l-primary); color: #fff; }

[dir="rtl"] body { font-family: "Cairo", "Plus Jakarta Sans", system-ui, sans-serif; }
[dir="rtl"] .eyebrow, [dir="rtl"] .divider, [dir="rtl"] .l-hero h1 { letter-spacing: 0; }
/* Saisie latine (dir="ltr") dans une page RTL : icône à droite, œil à gauche */
[dir="rtl"] .control input[dir="ltr"] { text-align: right; padding-left: 44px; padding-right: 42px; }
.ltr { direction: ltr; unicode-bidi: plaintext; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-22px) rotate(3deg); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, -30px); } }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 50% { opacity: .95; transform: scale(1.15) rotate(45deg); } }
@keyframes rise { from { transform: translateY(0); opacity: 0; } 10% { opacity: .9; } to { transform: translateY(-110vh); opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(125, 190, 255, .5); } 70%, 100% { box-shadow: 0 0 0 18px rgba(125, 190, 255, 0); } }
@keyframes shine { to { background-position: -250% 0; } }
@keyframes sweep { 0%, 55% { left: -80%; } 100% { left: 160%; } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .l-feats li { opacity: 1; }
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .login { grid-template-columns: 1fr; }
  .l-side { display: none; }
  .l-main { align-items: flex-start; padding-top: 64px; }
  .l-box h2 { font-size: 25px; }
}
@media (max-width: 420px) { .l-main { padding-inline: 18px; } .r-logo { width: 128px; } }

.credit { display: block; margin-top: 6px; font-size: 12px; }
.l-side .credit { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: rgba(255,255,255,.7); z-index: 3; }
.l-side .credit strong { color: #fff; }
.l-side .credit b { color: #9cc4ff; }

/* sélecteur de langue (FR | عربي) */
.lang-pill { direction: ltr; display: inline-flex; border: 1px solid #e6ebf3; border-radius: 999px; padding: 2px; gap: 2px; background: #fff; }
.lang-pill a { padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #64748b; text-decoration: none; }
.lang-pill a.on { background: #2563eb; color: #fff; }

html[dir="rtl"] body, html[dir="rtl"] input, html[dir="rtl"] button { font-family: "Cairo", "Tajawal", "Segoe UI", Tahoma, sans-serif; }

/* FR | عربي en haut de la page */
.login-lang { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 50; }
.login-lang .lang-pill { box-shadow: 0 4px 14px rgba(15, 30, 61, .15); }
