/* ==========================================================================
   Auth (Sign-in) page — two-panel floating card
   Layout & sizing adapted from the Siabjad Admina sign-in screen.
   ========================================================================== */

:root {
  --siabjad-primary: #487fff;
  --siabjad-primary-dark: #6366f1;
  --siabjad-gradient: linear-gradient(135deg, #487fff 0%, #6366f1 100%);
  --siabjad-wordmark-gradient: linear-gradient(120deg, #2563EB 0%, #3B82F6 40%, #06B6D4 75%, #22D3EE 100%);
  --auth-text: #374151;
  --auth-muted: #6b7280;
  --auth-border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--auth-text);
  -webkit-font-smoothing: antialiased;
}

/* Scene + background blobs */
.auth-scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #f5f6fa url('../images/body-bg.webp') center top / cover no-repeat fixed;
}
.auth-blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
}
.auth-blob--a { top: -6rem; left: -6rem; width: 22rem; height: 22rem; background: #bfdbfe; }
.auth-blob--b { right: -6rem; bottom: -8rem; width: 26rem; height: 26rem; background: #c7d2fe; }
.auth-blob--c { top: 30%; right: 20%; width: 16rem; height: 16rem; background: #e9d5ff; opacity: 0.4; }

/* Centering wrapper */
.auth-main {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
@media (min-width: 640px) {
  .auth-main { padding: 2rem; }
}

/* Card shell */
.auth-shell {
  display: flex;
  width: 100%;
  max-width: 64rem;
  overflow: hidden;
  border-radius: 2rem;
  background-color: #ffffff;
  box-shadow: 0 30px 70px rgba(16, 24, 40, 0.18);
}

/* Left brand panel */
.auth-shell__brand {
  display: none;
  width: 46%;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2.5rem;
  background: var(--siabjad-gradient);
}
@media (min-width: 1024px) {
  .auth-shell__brand { display: flex; }
}
.auth-brand__art {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
}
.auth-illustration {
  width: 20rem;
  max-width: 85%;
  height: auto;
  filter: drop-shadow(0 24px 48px rgba(16, 24, 40, 0.25));
}
.auth-brand__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;
}
.auth-brand__subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Right form panel */
.auth-shell__form {
  display: flex;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
}
@media (min-width: 640px) {
  .auth-shell__form { padding: 3rem 2.5rem; }
}
@media (min-width: 1024px) {
  .auth-shell__form { width: 54%; }
}
.auth-shell__form > * {
  width: 100%;
  max-width: 24rem;
  margin-inline: auto;
}

/* Mobile brand (logo + wordmark) */
.auth-brand-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.auth-brand-mobile__logo { height: 3rem; width: 3rem; }
.auth-brand-wordmark {
  display: inline-flex;
  align-items: center;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
  background: var(--siabjad-wordmark-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #2563EB;
}
.auth-brand-wordmark::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  margin-inline-start: 0.4rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, #2563EB 0%, #22D3EE 100%);
}

/* Heading */
.auth-page__head { margin-bottom: 1.75rem; }
.auth-page__title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #111827;
}
.auth-page__title::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-top: 0.75rem;
  border-radius: 999px;
  background: var(--siabjad-gradient);
}
.auth-page__subtitle {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--auth-muted);
}

/* Icon fields */
.auth-field { position: relative; }
.auth-field + .auth-field { margin-top: 1rem; }
.auth-field__icon {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 1.125rem;
  pointer-events: none;
}
.auth-field__toggle {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.15s ease;
}
.auth-field__toggle:hover { color: var(--siabjad-primary); }

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.75rem;
  background-color: #fafafa;
  color: var(--auth-text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-page .form-control {
  height: 3.25rem;
  padding-inline-start: 2.75rem;
  border-radius: 0.75rem;
  background-color: #fafafa;
  font-size: 0.875rem;
}
.auth-page .form-control.has-toggle { padding-inline-end: 2.75rem; }
.form-control::placeholder { color: #9ca3af; }
.form-control:focus {
  border-color: var(--siabjad-primary);
  box-shadow: 0 0 0 0.25rem rgba(72, 127, 255, 0.15);
}
.form-control[type="number"]::-webkit-outer-spin-button,
.form-control[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.form-control[type="number"] { -moz-appearance: textfield; }

/* Submit */
.auth-submit {
  display: flex;
  width: 100%;
  height: 3.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  border: 0;
  border-radius: 0.75rem;
  background: var(--siabjad-gradient);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.auth-submit:hover { filter: brightness(1.05); }
.auth-submit:disabled { opacity: 0.7; cursor: not-allowed; }
.auth-submit__icon {
  font-size: 1.125rem;
  transition: transform 0.15s ease;
}
.auth-submit:hover .auth-submit__icon { transform: translateX(3px); }

/* Spinner */
.auth-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.d-none { display: none !important; }

/* Toast */
.toast-error {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.35);
  opacity: 0;
  transition: top 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

/* Divider + Google button (shown on all screen sizes) */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  color: var(--auth-muted);
  font-size: 0.8125rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--auth-border);
}
.auth-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  height: 3.25rem;
  margin-top: 1rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.75rem;
  background-color: #ffffff;
  color: #374151;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-social:hover { background-color: #f9fafb; border-color: #d1d5db; }
.auth-social i,
.auth-social svg { font-size: 1.25rem; width: 1.25rem; height: 1.25rem; }

/* Top bar is mobile-only */
.auth-topbar {
  display: none;
}

/* ==========================================================================
   Mobile view — clean, iOS-style full-screen sign-in
   ========================================================================== */
@media (max-width: 1023px) {
  .auth-scene {
    background: #ffffff;
    background-image: none;
  }
  .auth-blob { display: none; }

  .auth-main {
    padding: 0;
    align-items: stretch;
  }

  .auth-shell {
    max-width: 100%;
    border-radius: 0;
    background-color: transparent;
    box-shadow: none;
  }

  .auth-shell__form {
    width: 100%;
    max-width: 30rem;
    min-height: 100vh;
    margin: 0 auto;
    justify-content: center;
    padding: calc(5.5rem + env(safe-area-inset-top)) 1.75rem calc(2rem + env(safe-area-inset-bottom));
  }

  /* Top bar: back (left) — title (center) — iOS-style icon (right) */
  .auth-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: 0.75rem 0.5rem;
    padding-top: calc(env(safe-area-inset-top) + 0.75rem);
  }
  .auth-topbar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background-color: #f2f2f7;
    color: #1c1c1e;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    transition: background-color 0.15s ease, transform 0.1s ease;
  }
  .auth-topbar__btn:active {
    background-color: #e5e7eb;
    transform: scale(0.96);
  }
  .auth-topbar__title {
    font-size: 1rem;
    font-weight: 600;
    color: #1c1c1e;
  }

  /* "atau" divider + Google button */
  .auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    color: #8e8e93;
    font-size: 0.8125rem;
  }
  .auth-divider::before,
  .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: #e5e7eb;
  }
  .auth-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    height: 3.25rem;
    margin-top: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    background-color: #ffffff;
    color: #1c1c1e;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.06);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  }
  .auth-social:active {
    background-color: #f2f2f7;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.08);
    transform: scale(0.99);
  }
  .auth-social i,
  .auth-social svg { font-size: 1.3rem; width: 1.3rem; height: 1.3rem; }

  /* App icon + wordmark, stacked */
  .auth-brand-mobile {
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2.75rem;
  }
  .auth-brand-mobile__logo {
    width: 5rem;
    height: 5rem;
    filter: drop-shadow(0 10px 22px rgba(16, 24, 40, 0.2));
  }
  .auth-brand-wordmark {
    font-size: 1.4rem;
    letter-spacing: 0.12em;
  }

  /* iOS-style fields */
  .auth-page .form-control {
    height: 3.25rem;
    padding-inline-start: 2.75rem;
    border: 0;
    border-radius: 0.875rem;
    background-color: #f2f2f7;
    font-size: 1rem;
  }
  .auth-page .form-control.has-toggle { padding-inline-end: 3rem; }
  .auth-page .form-control:focus {
    background-color: #eef1f6;
    box-shadow: none;
  }
  .auth-field__icon { color: #8e8e93; }
  .auth-field__toggle { color: #8e8e93; }
  .auth-field__toggle:hover { color: var(--siabjad-primary); }
  .auth-field + .auth-field { margin-top: 0.75rem; }

  /* iOS-style primary button */
  .auth-submit {
    height: 3.25rem;
    margin-top: 1.75rem;
    border-radius: 0.875rem;
    background: #007aff;
    font-size: 1rem;
    font-weight: 600;
  }
  .auth-submit:hover { filter: brightness(1.06); }
  .auth-submit__icon { display: none; }
}
