/* ==========================================================================
   Maya Support — sign-in page (index.php). Layout adapted from Maya Connect, Maya Support colours.
   ========================================================================== */
:root {
  --accent: #2a86b5;
  --accent-dark: #1f6d96;
  --navy: #393a6b;
  --navy-deep: #16173a;
  --ink: #111827;
  --muted: #6B7280;
  --line: #E2E7F0;
  --field: #F6F8FB;
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--navy-deep);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Animated background ---------- */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(125deg, #16173a 0%, #393a6b 40%, #1f4f78 70%, #16173a 100%);
  background-size: 300% 300%;
  animation: bgShift 22s ease-in-out infinite;
}
@keyframes bgShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  will-change: transform;
}
.auth-orb.o1 { width: 460px; height: 460px; background: #3d9bcb; top: -140px; left: -120px; animation: orb1 18s ease-in-out infinite; }
.auth-orb.o2 { width: 520px; height: 520px; background: #2F6FED; bottom: -180px; right: -160px; opacity: .45; animation: orb2 22s ease-in-out infinite; }
.auth-orb.o3 { width: 280px; height: 280px; background: #8B5CF6; top: 45%; left: 48%; opacity: .25; animation: orb1 26s ease-in-out infinite reverse; }
@keyframes orb1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(80px,60px) scale(1.12); } }
@keyframes orb2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-70px,-50px) scale(1.08); } }
.auth-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
#particles { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- Layout ---------- */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 32px;
}

/* ---------- Brand / marketing side ---------- */
.auth-intro { color: #fff; animation: rise .7s ease-out both; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}
.live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.auth-intro h2 {
  margin: 22px 0 14px;
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -.02em;
}
.auth-intro h2 em {
  font-style: normal;
  background: linear-gradient(90deg, #54aacf, #a9d8ec);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-intro > p { margin: 0 0 28px; max-width: 470px; font-size: 16px; line-height: 1.6; color: rgba(255,255,255,.72); }
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.feature-list li { display: flex; align-items: center; gap: 14px; font-size: 15px; color: rgba(255,255,255,.88); }
.feature-ico {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.feature-ico svg { width: 20px; height: 20px; color: #7cc3e0; }
.feature-list small { display: block; font-size: 13px; color: rgba(255,255,255,.55); }

/* ---------- Card ---------- */
.auth-card-wrap { display: flex; flex-direction: column; align-items: center; animation: rise .7s .1s ease-out both; }
.auth-card {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(3, 8, 25, .55), 0 0 0 1px rgba(255,255,255,.4) inset;
  overflow: hidden;
  position: relative;
}
.auth-card::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #54aacf 45%, var(--navy));
}
.auth-card-body { padding: 34px 36px 30px; }
.auth-logo { display: block; width: 210px; max-width: 75%; height: auto; margin: 0 auto 26px; }
.auth-title { margin: 0; font-size: 22px; font-weight: 700; text-align: center; color: var(--navy); }
.auth-sub { margin: 6px 0 24px; font-size: 14px; text-align: center; color: var(--muted); }

.alert-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #FEF2F2;
  border: 1px solid #FCD3D3;
  color: #B42318;
  font-size: 14px;
  font-weight: 500;
  animation: shake .4s ease-in-out;
}
.alert-error svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* Fields */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 600; color: #374151; }
.field-inner { position: relative; }
.field-inner .ico {
  position: absolute;
  left: 14px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: #9AA3B2;
  pointer-events: none;
  transition: color .15s;
}
.field-inner input,
.field-inner select {
  width: 100%;
  height: 50px;
  padding: 0 46px 0 44px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
}
.field-inner select { padding-right: 40px; cursor: pointer; }
.field-inner input::placeholder { color: #A3ABB9; }
.field-inner input:hover, .field-inner select:hover { border-color: #CBD3E1; }
.field-inner input:focus, .field-inner select:focus {
  background: #fff;
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(29, 52, 97, .12);
}
.field-inner:focus-within .ico { color: var(--navy); }
.select-caret { position: absolute; right: 14px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: #9AA3B2; pointer-events: none; }

.eye-btn {
  position: absolute;
  right: 6px; top: 50%;
  width: 38px; height: 38px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #8A94A6;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.eye-btn:hover { background: #EDF1F7; color: var(--navy); }
.eye-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.eye-btn svg { width: 18px; height: 18px; }
.caps-hint { display: none; margin-top: 6px; font-size: 12px; font-weight: 600; color: #B45309; }
.caps-hint.show { display: block; }

.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 22px; font-size: 13px; }
.chk-label { display: inline-flex; align-items: center; gap: 8px; color: #4B5563; cursor: pointer; user-select: none; }
.chk-label input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Primary button */
.btn-submit {
  position: relative;
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #3d9bcb 50%, var(--accent-dark) 100%);
  background-size: 200% 200%;
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .2px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(42, 134, 181, .35);
  transition: transform .15s, box-shadow .15s, background-position .4s;
}
.btn-submit:hover { transform: translateY(-1px); background-position: 100% 0; box-shadow: 0 14px 30px rgba(42, 134, 181, .45); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:focus-visible { outline: 3px solid rgba(42, 134, 181, .35); outline-offset: 3px; }
.btn-submit svg { width: 18px; height: 18px; transition: transform .2s; }
.btn-submit:hover svg { transform: translateX(3px); }
.btn-submit::after {
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  transform: skewX(-20deg);
  transition: left .6s;
}
.btn-submit:hover::after { left: 120%; }
.btn-submit .spinner { 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-submit.is-loading .spinner { display: inline-block; }
.btn-submit.is-loading .btn-ico { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-foot { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; color: var(--muted); }
.auth-copy { margin: 18px 0 0; display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.55); }
.auth-copy svg { width: 14px; height: 14px; }

/* Field-level validation messages (gen_validatorv31) */
.errors:not(:empty) { display: block; margin-top: 6px; font-size: 12px; font-weight: 600; color: #B42318 !important; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Screen-only (single column) variant ---------- */
.auth-page.is-single { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--field);
  border: 1px solid var(--line);
}
.user-badge .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--navy));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.user-badge strong { display: block; font-size: 15px; color: var(--ink); }
.user-badge span { font-size: 12px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 32px 20px; justify-items: center; align-content: center; }
  .auth-intro { text-align: center; max-width: 560px; }
  .auth-intro > p { margin-left: auto; margin-right: auto; }
  .feature-list { display: none; }
  .auth-intro h2 { margin: 16px 0 8px; }
}
@media (max-width: 575.98px) {
  .auth-page { padding: 20px 16px; gap: 18px; align-content: start; }
  .auth-intro h2 { font-size: 26px; }
  .auth-intro > p { display: none; }
  .auth-card-body { padding: 26px 20px 22px; }
  .auth-logo { width: 180px; margin-bottom: 20px; }
  .auth-orb { filter: blur(50px); }
  .auth-orb.o1 { width: 280px; height: 280px; }
  .auth-orb.o2 { width: 320px; height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg, .auth-orb, .live-pill .dot, .auth-intro, .auth-card-wrap, .alert-error { animation: none !important; }
  .btn-submit, .btn-submit::after { transition: none !important; }
}
