/* Saga CRM — auth (login / signup) */

:root {
  --auth-bg: #ffffff;
  --auth-fg: #0a0a0a;
  --auth-muted: #737373;
  --auth-border: #e5e5e5;
  --auth-input-border: #0a0a0a;
  --auth-radius-pill: 999px;
  --auth-radius-input: 10px;
  --auth-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body.auth-saga-page {
  margin: 0;
  min-height: 100%;
  background: var(--auth-bg);
  color: var(--auth-fg);
  font-family: var(--auth-font);
  -webkit-font-smoothing: antialiased;
}

.auth-saga {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem 2rem;
}

.auth-saga__inner {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}

.auth-saga__header {
  margin-bottom: 0.35rem;
}

.auth-saga__logo {
  display: flex;
  justify-content: center;
  margin-bottom: 0.45rem;
}

.auth-saga__logo img {
  display: block;
  height: auto;
  max-width: 132px;
}

.auth-saga__title {
  margin: 0;
  font-family: var(--auth-font);
  font-size: clamp(1.65rem, 4.8vw, 2rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.02em;
  text-align: center;
  color: #262626;
}

.auth-saga__subtitle {
  margin: 0 0 1.65rem;
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
  color: var(--auth-muted);
}

.auth-saga__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--auth-radius-pill);
  font-family: var(--auth-font);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.auth-saga__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-saga__btn--google {
  background: #fff;
  border: 1px solid var(--auth-border);
  color: var(--auth-fg);
}

.auth-saga__btn--google:hover:not(:disabled) {
  background: #fafafa;
  border-color: #d4d4d4;
}

.auth-saga__btn--primary {
  background: var(--auth-fg);
  border: 1px solid var(--auth-fg);
  color: #fff;
}

.auth-saga__btn--primary:hover:not(:disabled) {
  background: #262626;
  border-color: #262626;
}

.auth-saga__google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-saga__divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.35rem 0;
  color: var(--auth-muted);
  font-size: 0.875rem;
}

.auth-saga__divider::before,
.auth-saga__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

.auth-saga__field {
  margin-bottom: 0.85rem;
}

.auth-saga__input {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--auth-input-border);
  border-radius: var(--auth-radius-input);
  background: #fff;
  color: var(--auth-fg);
  font-family: var(--auth-font);
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.auth-saga__input::placeholder {
  color: #a3a3a3;
}

.auth-saga__input:focus {
  border-color: var(--auth-fg);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}

.auth-saga__input.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.auth-saga__field-error {
  margin: 0.45rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #dc2626;
  text-align: left;
}

.auth-saga__input[readonly] {
  background: #fafafa;
  color: var(--auth-muted);
}

.auth-saga__step-password {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition:
    grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease,
    margin-bottom 0.4s ease;
}

.auth-saga__step-password > .auth-saga__field {
  min-height: 0;
  overflow: hidden;
}

.auth-saga__step-password.is-visible {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-bottom: 0.85rem;
}

.auth-saga__field--password {
  margin-bottom: 0;
}

.auth-saga__input-wrap {
  position: relative;
}

.auth-saga__input--password {
  padding-right: 2.85rem;
}

.auth-saga__pwd-toggle {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #737373;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.auth-saga__pwd-toggle:hover {
  color: var(--auth-fg);
  background: rgba(0, 0, 0, 0.04);
}

.auth-saga__pwd-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.auth-saga__pwd-icon--show {
  display: none;
}

.auth-saga__pwd-toggle.is-visible .auth-saga__pwd-icon--hide {
  display: none;
}

.auth-saga__pwd-toggle.is-visible .auth-saga__pwd-icon--show {
  display: block;
}

.auth-saga__btn--submit {
  margin-top: 0;
}

.auth-saga__btn--outline {
  margin-top: 0.65rem;
  background: #fff;
  border: 1.5px solid var(--auth-border);
  color: var(--auth-fg);
  text-decoration: none;
  font-weight: 500;
}

.auth-saga__btn--outline:hover:not(:disabled) {
  background: #fafafa;
  border-color: #d4d4d4;
}

.auth-saga__btn[hidden] {
  display: none !important;
}

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

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

.auth-saga__fade {
  opacity: 0;
  animation: authPageFade 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.auth-saga__fade--1 { animation-delay: 0.04s; }
.auth-saga__fade--2 { animation-delay: 0.1s; }
.auth-saga__fade--3 { animation-delay: 0.16s; }
.auth-saga__fade--4 { animation-delay: 0.22s; }
.auth-saga__fade--5 { animation-delay: 0.3s; }
.auth-saga__fade--6 { animation-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  .auth-saga__fade,
  .auth-saga__step-password,
  .auth-saga__step-password.is-visible {
    opacity: 1;
    animation: none;
    transform: none;
    transition: none;
    grid-template-rows: 1fr;
  }
}

.auth-saga__switch {
  margin: 1.75rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--auth-muted);
}

.auth-saga__switch a {
  color: var(--auth-fg);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-saga__legal {
  margin: 2.5rem auto 0;
  width: 100%;
  max-width: 340px;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #a3a3a3;
}

.auth-saga__legal a {
  color: #737373;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-saga__spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.65s linear infinite;
}

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