/* ==========================================================================
   Auth pages — Employee & Admin login
   Two-panel "auth shell": a navy (employee) or mint (admin) brand panel with a
   live "schedule lattice" backdrop, beside a calm light form panel.
   Used only by templates/login.html and templates/admin_login.html.
   ========================================================================== */

/* --- Page frame ---------------------------------------------------------- */
/* base.html wraps logged-out users in .login-wrapper > main; our page block
   sits inside. Fill the viewport and let a flash alert flow above the shell. */
.login-wrapper {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 620px at 12% -8%, #e6f4ef 0%, transparent 58%),
    radial-gradient(900px 500px at 100% 108%, #e7eef6 0%, transparent 55%),
    #eef2f6;
}

.login-wrapper:has(.admin-login-page) {
  background:
    radial-gradient(1100px 620px at 12% -8%, #dcf0ea 0%, transparent 58%),
    radial-gradient(900px 500px at 100% 108%, #e4efec 0%, transparent 55%),
    #eef3f1;
}

.login-wrapper > main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.login-page,
.admin-login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

/* --- The shell ----------------------------------------------------------- */
.auth-shell {
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  background: #ffffff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    0 32px 64px -28px rgba(1, 18, 51, 0.42),
    0 12px 24px -16px rgba(1, 18, 51, 0.24);
  animation: authRise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes authRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Brand panel
   ========================================================================== */
.auth-brand {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #ffffff;
  background: linear-gradient(158deg, #1aa3bf 0%, #0a7aa3 52%, #084c73 100%);
  padding: 2.9rem 2.6rem;
  display: flex;
  flex-direction: column;
}

.admin-login-page .auth-brand {
  color: #012554;
  background: linear-gradient(158deg, #a6ddd1 0%, #63bbaa 54%, #3d9a89 100%);
}

/* Brand ornament — a calm pool of water. A canvas runs a height-field ripple
   simulation that refracts the brand gradient: gentle automatic drops for
   ambient motion, and bigger ripples where the pointer moves or taps. The
   canvas paints over the panel's base gradient (which stays as the no-JS /
   reduced-motion fallback). Palette is chosen per panel by the script. */
.auth-brand__water {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  /* the sim runs on a small backing buffer scaled up — smoothing reads as water */
  image-rendering: auto;
}

.auth-brand__content {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1.1rem;
  /* centre the logo + product name in the panel, both axes */
  justify-content: center;
  align-items: center;
  text-align: center;
}

.auth-brand__logo {
  display: flex;
  margin-bottom: 0.35rem;
}

/* Sized by height only -- the mark is square (templates/_brand_mark.html),
   where the wordmark it replaced was 2.7:1, so it is set larger than that
   wordmark was to carry comparable weight in the panel. `color` paints it:
   it is drawn with fill="currentColor". */
.auth-brand__logo {
  color: #fff;
}

.auth-brand__logo svg {
  height: 48px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.28));
}

.admin-login-page .auth-brand__logo svg {
  filter: drop-shadow(0 3px 8px rgba(1, 37, 84, 0.18));
}

.admin-login-page .auth-brand__logo { color: #012554; }

.auth-brand__title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

/* When the water canvas is active it composites the logo + title into the pool
   so they refract with the ripples. Hide the DOM copies with opacity (not
   display/visibility) so they stay laid out — the script measures their rects
   to position the canvas copies — and stay in the accessibility tree. Without
   JS/canvas the class is never added, so these remain the crisp visible copy. */
.auth-brand--water-active .auth-brand__logo,
.auth-brand--water-active .auth-brand__title {
  opacity: 0;
}

.auth-brand__footer {
  /* pinned to the bottom so the centred content sits in the true panel centre */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

/* ==========================================================================
   Form panel
   ========================================================================== */
.auth-form-panel {
  padding: 2.9rem 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.auth-form {
  width: 100%;
  max-width: 360px;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #2f9e8a;
  margin-bottom: 0.85rem;
}

.admin-login-page .auth-eyebrow { color: #012554; }

.auth-heading {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #12233b;
  margin: 0 0 0.45rem;
}

.auth-sub {
  font-size: 0.93rem;
  line-height: 1.5;
  color: #5a6a7a;
  margin: 0 0 1.6rem;
}

/* Inputs */
.auth-form .form-label {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: #3a4a5a;
  margin-bottom: 0.4rem;
}

.auth-form .form-label i { color: #2f9e8a; }
.admin-login-page .auth-form .form-label i { color: #012554; }

.auth-form .form-control {
  padding: 0.8rem 0.95rem;
  font-size: 0.98rem;
  color: #12233b;
  background: #f7f9fb;
  border: 1.5px solid #dfe6ec;
  border-radius: 11px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-form .form-control::placeholder { color: #9aa8b6; }

.auth-form .form-control:hover { border-color: #c7d2dc; }

.auth-form .form-control:focus {
  outline: none;
  background: #ffffff;
  border-color: #012554;
  box-shadow: 0 0 0 4px rgba(1, 37, 84, 0.13);
}

.admin-login-page .auth-form .form-control:focus {
  border-color: #2f9e8a;
  box-shadow: 0 0 0 4px rgba(47, 158, 138, 0.18);
}

/* Primary button */
.auth-form .btn-primary {
  width: 100%;
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.98rem;
  color: #ffffff;
  background: #012554;
  border: none;
  border-radius: 11px;
  box-shadow: 0 10px 22px -10px rgba(1, 37, 84, 0.65);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.auth-form .btn-primary:hover {
  background: #011a41;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(1, 37, 84, 0.6);
}

.auth-form .btn-primary:active { transform: translateY(0); }

.auth-form .btn-primary:focus-visible {
  outline: 3px solid rgba(47, 158, 138, 0.6);
  outline-offset: 2px;
}

/* Passkey / secondary outline button */
.auth-form .btn-outline-primary {
  width: 100%;
  padding: 0.8rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #012554;
  background: #ffffff;
  border: 1.5px solid #cdd8e2;
  border-radius: 11px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.auth-form .btn-outline-primary:hover {
  color: #012554;
  background: #f2f6fa;
  border-color: #012554;
  transform: translateY(-1px);
}

/* "or use email/password" divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.1rem 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: #8595a5;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e3e9ef;
}

/* Info note */
.auth-note {
  display: flex;
  gap: 0.65rem;
  margin-top: 1.3rem;
  padding: 0.8rem 0.9rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #46586a;
  background: #eef3f7;
  border: 1px solid #e0e8ef;
  border-radius: 11px;
}

.auth-note i {
  flex: none;
  margin-top: 0.1rem;
  color: #012554;
}

/* Footer switch link (Admin login / Back to employee login) */
.auth-switch-row {
  margin-top: 1.55rem;
  padding-top: 1.4rem;
  border-top: 1px solid #eceff3;
  text-align: center;
}

.auth-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #012554;
  text-decoration: none;
  transition: color 0.15s ease, gap 0.15s ease;
}

.auth-switch:hover {
  color: #2f9e8a;
  gap: 0.65rem;
}

.auth-switch--muted {
  font-weight: 500;
  color: #6a7a8a;
}

.auth-switch--muted:hover { color: #012554; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
    max-width: 440px;
  }

  .auth-brand {
    padding: 1.9rem 1.9rem 1.75rem;
  }

  .auth-brand__content { gap: 0.6rem; }
  .auth-brand__footer { display: none; }

  .auth-form-panel { padding: 2rem 1.9rem 2.25rem; }
  .auth-form { max-width: 100%; }
}

@media (max-width: 480px) {
  .login-page,
  .admin-login-page { padding: 0; }

  .login-wrapper,
  .login-wrapper:has(.admin-login-page) { background: #ffffff; }

  .auth-shell {
    max-width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    align-content: start;
  }
}

/* ==========================================================================
   Motion / spinner
   ========================================================================== */
.fa-spin { animation: fa-spin 1s infinite linear; }

@keyframes fa-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell { animation: none; }
  .auth-form .btn-primary:hover,
  .auth-form .btn-outline-primary:hover { transform: none; }
}
