/* ==========================================================================
   Nawras Marine — Auth pages (sign in, registration)
   Layout: form column + cinematic visual panel.
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  background: var(--bg);
}

/* ---- Form column ------------------------------------------------------ */
.auth__main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px clamp(20px, 5vw, 72px);
  overflow: hidden;
}
.auth__main::before {
  /* faint compass watermark behind the form */
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  inset-inline-end: -220px; top: -180px;
  background: url(../img/logo-mark.png) center/contain no-repeat;
  opacity: .035;
  animation: spin 120s linear infinite;
  pointer-events: none;
}
.auth__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.auth__body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 460px);
  margin-inline: auto;
  padding-block: 36px;
}
.auth__foot { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); }
.auth__foot a:hover { color: var(--primary); }

.auth__title { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.25rem); font-weight: var(--fw-bold); letter-spacing: -.02em; line-height: 1.2; }
.auth__title .wave-hand { display: inline-block; transform-origin: 70% 70%; animation: hand-wave 2.4s 1s var(--ease-in-out) 2; }
@keyframes hand-wave { 0%, 60%, 100% { transform: rotate(0) } 10%, 30% { transform: rotate(14deg) } 20% { transform: rotate(-8deg) } 40% { transform: rotate(-4deg) } 50% { transform: rotate(10deg) } }

.auth__sub { color: var(--text-2); margin-top: 8px; }

.auth-form { display: flex; flex-direction: column; gap: 18px; margin-top: 28px; }
.auth-form__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link { color: var(--primary); font-weight: var(--fw-semi); font-size: var(--fs-sm); transition: color var(--dur-2); }
.link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.sso { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sso .btn { height: 46px; font-size: var(--fs-sm); }
.sso svg { width: 18px; height: 18px; }

.auth-switch { text-align: center; font-size: var(--fs-sm); color: var(--text-2); }

/* ---- View switching (login / mfa / forgot / sent) ---------------------- */
.auth-view { display: none; }
.auth-view.is-active { display: block; animation: view-in var(--dur-4) var(--ease-out) backwards; }
@keyframes view-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 28px)); filter: blur(4px) } to { opacity: 1; transform: none; filter: none } }

.view-back { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-semi); margin-bottom: 20px; }
.view-back i { transition: transform var(--dur-2) var(--ease-out); }
html[dir="rtl"] .view-back i { transform: scaleX(-1); }
.view-back:hover { color: var(--primary); }
.view-back:hover i { transform: translateX(-3px); }
html[dir="rtl"] .view-back:hover i { transform: scaleX(-1) translateX(-3px); }

.view-icon {
  position: relative;
  width: 72px; height: 72px;
  display: grid; place-items: center;
  border-radius: 22px;
  font-size: 2rem;
  color: var(--white);
  background: var(--grad-brand);
  box-shadow: var(--sh-glow-navy);
  margin-bottom: 22px;
}
.view-icon::after {
  content: "";
  position: absolute; inset: -6px;
  border-radius: 26px;
  border: 2px solid rgb(19 179 185 / .45);
  animation: icon-ring 2.4s var(--ease-out) infinite;
}
@keyframes icon-ring { 0% { transform: scale(.92); opacity: .9 } 100% { transform: scale(1.3); opacity: 0 } }

.resend { text-align: center; font-size: var(--fs-sm); color: var(--text-3); }
.resend b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- Quick demo login ------------------------------------------------- */
.quick {
  margin-top: 28px;
  padding: 18px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
}
.quick__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.quick__title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.quick__title i { color: var(--coral-500); font-size: 1.1rem; }
.quick__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick__btn {
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--text);
  text-align: start;
  line-height: 1.25;
  transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2), box-shadow var(--dur-3), background var(--dur-2);
}
.quick__btn i {
  width: 28px; height: 28px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: 1rem;
  color: var(--tone, var(--navy-700));
  background: color-mix(in srgb, var(--tone, var(--navy-700)) 12%, transparent);
  transition: transform var(--dur-3) var(--ease-spring), background var(--dur-2), color var(--dur-2);
}
.quick__btn:hover { transform: translateY(-2px); border-color: var(--tone, var(--accent)); box-shadow: var(--sh-md); }
.quick__btn:hover i { transform: rotate(-8deg) scale(1.1); background: var(--tone, var(--navy-700)); color: var(--white); }
.quick__btn.is-active { border-color: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 22%, transparent); }
.quick__btn--admin { --tone: var(--coral-500); }

/* ---- Visual panel ------------------------------------------------------ */
.auth__visual {
  position: sticky;
  top: 0;
  height: 100vh;
  margin: 12px;
  margin-inline-start: 0;
  height: calc(100vh - 24px);
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
  color: var(--white);
  background: var(--navy-950);
}
.auth__photo {
  position: absolute; inset: 0;
  z-index: -3;
  background: center/cover no-repeat;
  animation: ken-burns 26s var(--ease-in-out) infinite alternate;
}
.auth__visual::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgb(4 20 40 / .55) 0%, rgb(4 20 40 / .05) 35%, rgb(4 20 40 / .35) 60%, rgb(4 20 40 / .92) 100%),
    linear-gradient(90deg, rgb(6 32 63 / .35), transparent 60%);
}
.auth__visual::after {
  /* grid texture, like a chart plotter */
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgb(255 255 255 / .05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / .05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 70% 30%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 0%, transparent 70%);
}
.auth__visual-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 3vw, 44px);
}

.visual-badge {
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px;
  padding-inline: 8px 14px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--white);
  background: rgb(255 255 255 / .1);
  border: 1px solid rgb(255 255 255 / .18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.visual-badge .live-dot { --c: #3ee6a6; margin-inline-start: 6px; }

/* Route map overlay */
.route-map {
  position: absolute;
  inset: 10% 6% auto 6%;
  height: 46%;
  pointer-events: none;
}
.route-map svg { width: 100%; height: 100%; overflow: visible; }
.route-map .route { fill: none; stroke: rgb(116 221 224 / .75); stroke-width: 1.6; stroke-dasharray: 5 7; animation: dash-flow 2.2s linear infinite; }
.route-map .route--2 { stroke: rgb(245 135 111 / .7); animation-duration: 3s; }
.route-map .port { fill: var(--teal-400); }
.route-map .port-ring { fill: none; stroke: var(--teal-300); stroke-width: 1.2; transform-box: fill-box; transform-origin: center; animation: sonar 2.4s var(--ease-out) infinite; }
.route-map .port-ring--coral { stroke: var(--coral-400); animation-delay: 1.2s; }
.route-map .port--coral { fill: var(--coral-500); }
.route-map .vessel { fill: var(--white); filter: drop-shadow(0 0 6px rgb(52 201 205 / .9)); }

/* Floating live cards */
.float-card {
  position: absolute;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px;
  border-radius: 18px;
  background: rgb(6 32 63 / .45);
  border: 1px solid rgb(255 255 255 / .16);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 20px 50px -20px rgb(0 0 0 / .6);
  font-size: var(--fs-xs);
  animation: float 7s var(--ease-in-out) infinite;
}
.float-card__icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 1.15rem;
  background: var(--tone, var(--teal-500));
  color: var(--white);
}
.float-card b { display: block; font-size: var(--fs-sm); }
.float-card span { color: var(--navy-200); }
.float-card--1 { top: 22%; inset-inline-end: 8%; }
.float-card--2 { top: 42%; inset-inline-start: 7%; animation-delay: -2.5s; --tone: var(--coral-500); }
.float-card--3 { top: 58%; inset-inline-end: 14%; animation-delay: -4.5s; --tone: var(--navy-500); }

.visual-copy { max-width: 520px; }
.visual-copy h2 { font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.6rem); font-weight: var(--fw-bold); line-height: 1.2; letter-spacing: -.02em; }
.visual-copy h2 em { font-style: normal; color: var(--teal-300); }

/* Rotating testimonials */
.slides { position: relative; min-height: 132px; margin-top: 18px; }
.slide {
  position: absolute; inset: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.slide.is-active { opacity: 1; transform: none; }
.slide p { color: var(--navy-100); font-size: var(--fs-md); line-height: 1.7; }
.slide footer { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: var(--fs-xs); color: var(--navy-200); }
.slide footer b { color: var(--white); font-size: var(--fs-sm); }

.dots { display: flex; gap: 6px; margin-top: 14px; }
.dots button { width: 8px; height: 8px; border-radius: 8px; background: rgb(255 255 255 / .3); transition: width var(--dur-4) var(--ease-out), background var(--dur-3); }
.dots button.is-active { width: 28px; background: var(--teal-400); }

.visual-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 26px; }
.visual-stats div {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgb(255 255 255 / .07);
  border: 1px solid rgb(255 255 255 / .12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.visual-stats b { display: block; font-size: 1.5rem; font-weight: var(--fw-black); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.visual-stats span { font-size: var(--fs-xs); color: var(--navy-200); }

/* ---- Success overlay (after sign in) ---------------------------------- */
.auth-success {
  position: fixed; inset: 0;
  z-index: var(--z-loader);
  display: grid; place-items: center;
  background: var(--grad-ocean);
  color: var(--white);
  text-align: center;
  clip-path: circle(0% at var(--cx, 50%) var(--cy, 50%));
  transition: clip-path .9s var(--ease-in-out);
  pointer-events: none;
}
.auth-success.is-open { clip-path: circle(150% at var(--cx, 50%) var(--cy, 50%)); pointer-events: auto; }
.auth-success__check { width: 96px; height: 96px; margin: 0 auto 22px; }
.auth-success__check circle { fill: none; stroke: rgb(255 255 255 / .2); stroke-width: 3; }
.auth-success__check circle.arc { stroke: var(--teal-400); stroke-dasharray: 290; stroke-dashoffset: 290; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.auth-success__check path { fill: none; stroke: var(--white); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; }
.auth-success.is-open .arc  { animation: dash .9s .5s var(--ease-out) forwards; }
.auth-success.is-open path  { animation: dash .45s 1.2s var(--ease-out) forwards; }
.auth-success h3 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); opacity: 0; }
.auth-success p  { color: var(--navy-200); margin-top: 6px; opacity: 0; }
.auth-success.is-open h3 { animation: fade-up .6s 1.1s var(--ease-out) forwards; }
.auth-success.is-open p  { animation: fade-up .6s 1.25s var(--ease-out) forwards; }
.auth-success .progress { width: 220px; margin: 22px auto 0; background: rgb(255 255 255 / .15); opacity: 0; }
.auth-success.is-open .progress { animation: fade-in .4s 1.4s forwards; }
.auth-success.is-open .progress__bar { animation: fill-bar 1.6s 1.5s var(--ease-in-out) forwards; width: 0; }
@keyframes fill-bar { to { width: 100% } }

/* ---- Responsive ------------------------------------------------------- */
/* Short laptop screens: keep the visual panel from stacking into itself */
@media (max-height: 960px) {
  .float-card--2, .float-card--3 { display: none; }
  .float-card--1 { top: 14%; }
  .route-map { inset-block-start: 8%; height: 34%; }
  .visual-copy h2 { font-size: clamp(1.5rem, 1rem + 1.4vw, 2.1rem); }
  .slides { min-height: 118px; margin-top: 12px; }
  .visual-stats { margin-top: 16px; }
}
@media (max-height: 760px) {
  .slides, .dots { display: none; }
  .float-card--1 { display: none; }
}

@media (max-width: 1100px) {
  .quick__grid { grid-template-columns: repeat(2, 1fr); }
  .float-card--3 { display: none; }
}
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth__visual { display: none; }
  .auth__main { background: var(--bg); }
}
@media (max-width: 480px) {
  .sso { grid-template-columns: 1fr; }
  .quick__grid { grid-template-columns: repeat(2, 1fr); }
  .otp input { width: 44px; height: 54px; }
}
