/* ============================================================
   login.css – ZabiTech login page
   Depends on css/style.css for tokens, header, footer, buttons.
   ============================================================ */

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: linear-gradient(145deg, #e9f3ff, #ffffff);
  min-height: calc(100vh - var(--header-height));
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 48px -20px rgba(15, 23, 42, .18),
              0 2px 8px rgba(15, 23, 42, .04);
  padding: 40px 36px 32px;
  animation: fadeIn .5s cubic-bezier(.2, .8, .2, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   HEADINGS
   ============================================================ */
.login-head {
  text-align: center;
  margin-bottom: 26px;
}

.login-title {
  font-size: clamp(1.4rem, 3vw, 1.65rem);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -.01em;
  margin: 0 0 8px;
  line-height: 1.2;
}

.login-sub {
  color: var(--muted);
  font-size: .95rem;
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   FIELDS
   ============================================================ */
.login-container .field {
  text-align: left;
  margin-bottom: 16px;
}

.login-container .field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input-wrap { position: relative; }

.login-container .field input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-2, #cbd5e1);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.login-container .field input::placeholder { color: var(--muted-2, #94a3b8); }

.login-container .field input:hover:not(:focus) {
  border-color: #b8c2cc;
}

.login-container .field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft, rgba(0, 120, 212, .14));
}

.login-container .field input[aria-invalid="true"] {
  border-color: #f87171;
  background: #fffafa;
}
.login-container .field input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .14);
}

/* Password show/hide */
.login-container .field input.has-toggle {
  padding-right: 72px;
}

.toggle-pw {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}
.toggle-pw:hover { background: var(--primary-soft, rgba(0, 120, 212, .08)); }
.toggle-pw:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ============================================================
   ERRORS
   ============================================================ */
.login-container .error {
  display: none;
  margin: 6px 0 0;
  font-size: 12.5px;
  font-weight: 500;
  color: #dc2626;
  text-align: left;
  line-height: 1.45;
}
.login-container .error.is-visible { display: block; }

/* ============================================================
   REMEMBER / FORGOT
   ============================================================ */
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
  font-size: 13px;
  flex-wrap: wrap;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
}
.remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  flex: none;
  accent-color: var(--primary);
  cursor: pointer;
}

.forgot {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.forgot:hover { text-decoration: underline; }

/* ============================================================
   SUBMIT BUTTON — overrides global .btn-primary
   to be full-width + taller on the auth pages
   ============================================================ */
.login-container .btn-primary.btn-block {
  width: 100%;
  padding: 13px 20px;
  font-size: 15.5px;
  border-radius: 10px;
  margin-top: 4px;
  box-shadow: 0 6px 18px -6px rgba(0, 120, 212, .55);
}
.login-container .btn-primary.btn-block:hover:not(:disabled) {
  box-shadow: 0 10px 24px -8px rgba(0, 120, 212, .7);
  transform: translateY(-1px);
}
.login-container .btn-primary.btn-block:active:not(:disabled) {
  transform: translateY(1px);
}
.login-container .btn-primary.btn-block:disabled {
  cursor: not-allowed;
  opacity: .72;
  transform: none;
  box-shadow: none;
}

/* Spinner inside the button */
.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex: none;
}
.btn-primary[aria-busy="true"] .spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   GOOGLE BUTTON
   ============================================================ */
.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  color: #1f2937;
  border: 1px solid #dadce0;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.btn-google:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #c7cbd1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.btn-google:active:not(:disabled) { background: #f1f5f9; }
.btn-google:disabled {
  cursor: not-allowed;
  opacity: .65;
}
.btn-google:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.btn-google svg { flex: none; }

/* ============================================================
   "OR" DIVIDER
   ============================================================ */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 20px;
  color: var(--muted-2, #94a3b8);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   BOTTOM TEXT
   ============================================================ */
.auth-alt {
  margin: 22px 0 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
.auth-alt a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}
.auth-alt a:hover { text-decoration: underline; }

.auth-status {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--primary);
  min-height: 18px;
  text-align: center;
  line-height: 1.45;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .login-page {
    padding: 40px 16px;
    align-items: flex-start;
  }
  .login-container {
    padding: 28px 22px 24px;
    border-radius: 16px;
  }
  .login-head { margin-bottom: 20px; }
  .login-title { font-size: 1.35rem; }
  .login-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}