/* ==========================================================================
   Wafi CRM - Authentication pages (login)
   Builds on css/landing.css tokens: same palette, type, buttons and fields.
   ========================================================================== */

.auth-body { background: #fff; min-height: 100dvh; }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); min-height: 100dvh; }

/* ---------- Form side ---------- */
.auth-main { display: flex; flex-direction: column; padding: 28px 48px; position: relative; isolation: isolate; }
.auth-main::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 40% at 0% 0%, var(--green-50), transparent 70%);
}
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-back { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-radius: 999px; transition: color .2s, background-color .2s; }
.auth-back:hover { color: var(--green-800); background: var(--green-50); }

.auth-panel { width: 100%; max-width: 420px; margin: auto; padding: 48px 0; }
.auth-title { font-size: clamp(2rem, 3vw, 2.6rem); line-height: 1.08; letter-spacing: -0.04em; font-weight: 700; }
.auth-sub { color: var(--muted); margin-top: 10px; font-size: 1.05rem; }

.auth-alert { display: flex !important; gap: 10px; align-items: flex-start; margin: 26px 0 0; }
.auth-alert .ph { font-size: 20px; flex: none; margin-top: 1px; }

.auth-form { margin-top: 30px; }
.auth-form .field { margin-bottom: 20px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.input-icon { position: relative; }
.input-icon > .ph { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 19px; color: #7a8a85; pointer-events: none; transition: color .2s; }
.input-icon input { padding-left: 44px; height: 50px; }
.input-icon:focus-within > .ph { color: var(--green-600); }
.input-icon input[type="password"], .input-icon input#password { padding-right: 48px; }
.reveal-pwd { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: 19px; transition: background-color .2s, color .2s; }
.reveal-pwd:hover { background: var(--green-50); color: var(--green-700); }
.auth-link { font-size: 13.5px; font-weight: 600; color: var(--green-700); padding: 2px 0; }
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-help { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); background: var(--green-50); border: 1px solid var(--green-100); border-radius: var(--r-input); padding: 12px 14px; line-height: 1.5; }
.auth-help a { color: var(--green-700); font-weight: 600; text-decoration: underline; }
.auth-form .btn { margin-top: 8px; }

.auth-switch { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14.5px; text-align: center; }
.auth-switch a { color: var(--green-700); font-weight: 650; }
.auth-switch a:hover { text-decoration: underline; text-underline-offset: 3px; }

.auth-footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.auth-footer nav { display: flex; gap: 18px; }
.auth-footer a:hover { color: var(--green-700); }

/* ---------- Visual side ---------- */
.auth-visual { position: relative; overflow: hidden; isolation: isolate; color: #fff; margin: 14px 14px 14px 0; border-radius: 28px; }
.auth-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transform: scale(1.04); }
.auth-visual::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(160deg, rgba(21, 82, 163, .55) 0%, rgba(14, 61, 124, .88) 45%, rgba(8, 18, 38, .97) 100%); }
.auth-visual-inner { height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 56px 56px 48px; gap: 40px; }

.auth-stage { perspective: 1800px; flex: 1; min-height: 320px; position: relative; }
.auth-scene {
  --rx: 0deg; --ry: 0deg;
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: rotateX(calc(10deg + var(--rx))) rotateY(calc(-18deg + var(--ry))) rotateZ(2deg);
  transition: transform .9s var(--ease);
}
.auth-shot { position: absolute; border-radius: var(--r-media); overflow: hidden; background: #fff; border: 1px solid rgba(255, 255, 255, .25); }
.auth-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.auth-shot-main { width: 92%; aspect-ratio: 16 / 10; right: 0; top: 8%; box-shadow: 0 50px 100px -30px rgba(0, 0, 0, .6); }
.auth-shot-doc { width: 34%; aspect-ratio: 4 / 5; left: 0; bottom: 0; transform: translateZ(120px); box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .65); }
.auth-shot-doc img { object-position: top center; }

.auth-quote p { font-size: clamp(1.35rem, 2vw, 1.75rem); line-height: 1.3; letter-spacing: -0.025em; font-weight: 600; max-width: 30ch; }
.auth-quote ul { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.auth-quote li { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 550; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.auth-quote .ph { font-size: 17px; color: var(--green-200); }

/* ---------- Motion (disabled with reduced motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .auth-panel > * { animation: auth-rise .8s var(--ease) both; }
  .auth-panel > *:nth-child(2) { animation-delay: .06s; }
  .auth-panel > *:nth-child(3) { animation-delay: .12s; }
  .auth-panel > *:nth-child(4) { animation-delay: .18s; }
  .auth-panel > *:nth-child(5) { animation-delay: .24s; }
  .auth-scene { animation: auth-scene 1.5s var(--ease) both .2s; }
  .auth-shot-doc { animation: auth-float 7s ease-in-out infinite 1.8s; }
  .auth-photo { animation: auth-zoom 18s ease-out both; }
  @keyframes auth-rise { from { opacity: 0; transform: translateY(16px); } }
  @keyframes auth-scene { from { opacity: 0; transform: rotateX(26deg) rotateY(-36deg) translateY(50px) scale(.94); } }
  @keyframes auth-float { 50% { transform: translateZ(120px) translateY(-10px); } }
  @keyframes auth-zoom { from { transform: scale(1.12); } }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-main { padding: 22px 24px; }
}
@media (max-width: 480px) {
  .auth-main { padding: 18px 16px; }
  .auth-back span { display: none; }
  .auth-panel { padding: 36px 0; }
  .auth-footer { justify-content: center; text-align: center; }
}

/* Pages sans visuel (mot de passe oublié, confirmation d'email) :
   sur ordinateur, carte centrée sur un fond aux couleurs de Wafi ; sur mobile, page simple. */
.auth-layout-single {
  display: block; min-height: 100dvh;
  background:
    radial-gradient(55% 45% at 50% 0%, rgba(21, 82, 163, .10), transparent 70%),
    radial-gradient(35% 35% at 100% 100%, rgba(214, 154, 60, .10), transparent 70%),
    #F4F7FB;
}
.auth-layout-single .auth-main { min-height: 100dvh; width: 100%; padding: 28px 48px 40px; }
.auth-layout-single .auth-main::before { display: none; }
.auth-layout-single .auth-top { width: 100%; max-width: 1180px; margin: 0 auto; }
.auth-layout-single .auth-panel {
  max-width: 480px; margin: auto; padding: 44px 44px 36px;
  background: #fff; border: 1px solid #E3E8F0; border-radius: 24px;
  box-shadow: 0 1px 2px rgba(12, 26, 51, .04), 0 28px 60px -28px rgba(12, 26, 51, .28);
}
.auth-layout-single .auth-title { font-size: clamp(1.7rem, 2.3vw, 2.05rem); }
.auth-layout-single .auth-switch { margin-top: 22px; text-align: center; }
.auth-badge {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 22px;
  border-radius: 16px; background: var(--green-50, #EEF3FB); color: var(--green-800, #0E3D7C); font-size: 28px;
}
@media (max-width: 640px) {
  .auth-layout-single { background: #fff; }
  .auth-layout-single .auth-main { padding: 18px 16px; }
  .auth-layout-single .auth-panel { padding: 36px 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
}

/* Compte de démonstration */
.auth-demo {
  display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 16px;
  border: 1px dashed var(--green-200, #B9CDEB); border-radius: 12px; background: var(--green-50, #EEF3FB);
  color: var(--green-800, #0E3D7C); text-decoration: none;
}
.auth-demo:hover { border-style: solid; }
.auth-demo .ph { font-size: 24px; flex: none; }
.auth-demo span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.auth-demo small { color: var(--muted, #5A6680); font-size: 12.5px; }
