/* ==========================================================
   Petshop Auth — login / register / password / OTP
   All colours come from theme tokens (--theme-*) set in theme.css
   ========================================================== */

.sf-page.sf-auth {
  --auth-text: #2A2118;
  --auth-heading: #2A2118;
  --auth-primary: var(--theme-primary, var(--color-primary, #4A5C47));
  --auth-primary-dark: var(--theme-accent-dark, var(--color-accentDark, #5B7057));
  --auth-muted: var(--theme-muted, var(--color-muted, #9B8E7A));
  --auth-line: var(--theme-border, var(--color-border, #C4B8A0));
  --auth-input: var(--theme-bg-muted, var(--color-cream, #E8DDD0));
  --auth-soft: var(--theme-bg, var(--color-background, #F8F4EE));
  --auth-surface: var(--theme-surface, var(--color-surfaceCard, #F2EDE3));
  --auth-danger: var(--theme-danger, var(--color-danger, #b91c1c));
  --auth-success: var(--theme-success, #4A5C47);
  --auth-radius: var(--theme-radius, 0px);
  --auth-font: var(--theme-font-family, Jost, system-ui, sans-serif);

  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 64px;
  background: var(--auth-soft);
  color: var(--auth-text, #2A2118);
  font-family: var(--auth-font);
}

.sf-auth__card {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  background: var(--auth-surface);
  border: 1px solid var(--auth-line);
  border-radius: calc(var(--auth-radius) + 8px);
  padding: 36px 32px 28px;
  box-shadow: var(--theme-shadow, 0 2px 8px rgba(0, 0, 0, 0.06));
  box-sizing: border-box;
}

.sf-auth__card--wide {
  max-width: 720px;
}

/* Tabs */
.sf-auth__tabs {
  display: flex;
  gap: 4px;
  background: color-mix(in srgb, var(--auth-primary) 12%, var(--auth-surface));
  border-radius: 999px;
  padding: 5px;
  margin: 0 0 28px;
}

.sf-auth__tab {
  flex: 1;
  text-align: center;
  padding: 11px 14px;
  border-radius: 999px;
  font-family: var(--auth-font);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--auth-heading, #2A2118) !important;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.sf-auth__tab.is-active {
  background: var(--auth-surface);
  color: var(--auth-primary-dark);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--auth-heading) 14%, transparent);
}

.sf-auth__tab:not(.is-active):hover {
  color: var(--auth-primary);
}

/* Title */
.sf-auth__title {
  margin: 0 0 8px;
  font-family: var(--auth-font);
  font-size: clamp(26px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--auth-heading, #2A2118) !important;
  text-align: center;
}

.sf-auth__lede {
  margin: 0 0 26px;
  font-family: var(--auth-font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--auth-muted);
  text-align: center;
}

/* Alerts */
.sf-auth__alert {
  display: none;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: var(--auth-radius);
  font-family: var(--auth-font);
  font-size: 13px;
  line-height: 1.45;
}

.sf-auth__alert.is-visible,
.sf-auth__alert:not(:empty) {
  display: block;
}

.sf-auth__alert--error,
.sf-auth__alert.is-error {
  background: color-mix(in srgb, var(--auth-danger) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--auth-danger) 35%, #fff);
  color: var(--auth-danger);
}

.sf-auth__alert--success,
.sf-auth__alert.is-success {
  background: color-mix(in srgb, var(--auth-success) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--auth-success) 35%, #fff);
  color: var(--auth-success);
}

/* Form */
.sf-auth__form {
  display: grid;
  gap: 0;
}

.sf-auth__field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.sf-auth__field label {
  font-family: var(--auth-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--auth-heading, #2A2118) !important;
}

.sf-auth__muted {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--auth-muted);
  font-size: 11px;
}

.sf-auth__field input,
.sf-auth__field select,
.sf-auth__field textarea {
  width: 100%;
  min-height: 50px;
  padding: 13px 18px;
  border: 1.5px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background: color-mix(in srgb, var(--auth-input) 55%, #fff);
  color: var(--auth-text, #2A2118);
  font-family: var(--auth-font);
  font-size: 15px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  -webkit-appearance: none;
  appearance: none;
}

.sf-auth__field input::placeholder,
.sf-auth__field textarea::placeholder {
  color: color-mix(in srgb, var(--auth-muted) 80%, #fff);
}

.sf-auth__field input:focus,
.sf-auth__field select:focus,
.sf-auth__field textarea:focus {
  border-color: var(--auth-primary);
  background: var(--auth-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-primary) 22%, transparent);
}

.sf-auth__field textarea {
  min-height: 96px;
  resize: vertical;
}

.sf-auth__row {
  display: grid;
  gap: 0;
}

@media (min-width: 640px) {
  .sf-auth__row--2 {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

/* Password field + toggle */
.sf-auth__password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.sf-auth__password-wrap input {
  padding-right: 52px;
}

.sf-auth__password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--auth-surface) 80%, transparent);
  color: var(--auth-heading, #2A2118) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s ease, color 0.18s ease;
}

.sf-auth__password-toggle:hover,
.sf-auth__password-toggle:focus-visible {
  background: var(--auth-surface);
  color: var(--auth-primary);
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--auth-primary) 28%, transparent);
}

.sf-auth__password-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

.sf-auth__password-toggle .sf-auth__eye-off {
  display: none;
}

.sf-auth__password-toggle.is-visible .sf-auth__eye-on {
  display: none;
}

.sf-auth__password-toggle.is-visible .sf-auth__eye-off {
  display: block;
}

/* Strength meter */
.sf-auth__strength {
  display: none;
  margin-top: 2px;
}

.sf-auth__strength.is-visible {
  display: block;
}

.sf-auth__strength-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--auth-line);
  overflow: hidden;
}

.sf-auth__strength-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--auth-danger);
  transition: width 0.25s ease, background 0.25s ease;
}

.sf-auth__strength[data-level="weak"] .sf-auth__strength-bar > span,
.sf-auth__strength.is-weak .sf-auth__strength-bar > span {
  width: 25%;
  background: var(--auth-danger);
}

.sf-auth__strength[data-level="fair"] .sf-auth__strength-bar > span,
.sf-auth__strength.is-fair .sf-auth__strength-bar > span {
  width: 50%;
  background: #d97706;
}

.sf-auth__strength[data-level="good"] .sf-auth__strength-bar > span,
.sf-auth__strength.is-good .sf-auth__strength-bar > span {
  width: 75%;
  background: var(--auth-primary);
}

.sf-auth__strength[data-level="strong"] .sf-auth__strength-bar > span,
.sf-auth__strength.is-strong .sf-auth__strength-bar > span {
  width: 100%;
  background: var(--auth-success);
}

.sf-auth__strength-label {
  margin: 6px 0 0;
  font-family: var(--auth-font);
  font-size: 12.5px;
  color: var(--auth-muted);
}

.sf-auth__strength[data-level="weak"] .sf-auth__strength-label { color: var(--auth-danger); }
.sf-auth__strength[data-level="fair"] .sf-auth__strength-label { color: #d97706; }
.sf-auth__strength[data-level="good"] .sf-auth__strength-label { color: var(--auth-primary-dark); }
.sf-auth__strength[data-level="strong"] .sf-auth__strength-label { color: var(--auth-success); }

.sf-auth__hint,
.sf-auth__match {
  margin: 0;
  font-family: var(--auth-font);
  font-size: 12.5px;
  color: var(--auth-muted);
}

.sf-auth__match.is-error {
  color: var(--auth-danger);
}

.sf-auth__match.is-ok {
  color: var(--auth-success);
}

.sf-auth__legal {
  margin: 8px 0 0;
  text-align: center;
  font-family: var(--auth-font);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--auth-muted);
}

.sf-auth__legal a {
  color: var(--auth-heading, #2A2118) !important;
  font-weight: 700;
  text-decoration: none;
}

.sf-auth__legal a:hover {
  color: var(--auth-primary);
  text-decoration: underline;
}

/* Buttons */
.sf-auth__actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.sf-page.sf-auth .sf-btn,
.sf-auth__card .sf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--auth-radius);
  font-family: var(--auth-font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.sf-page.sf-auth .sf-btn--primary,
.sf-auth__card .sf-btn--primary {
  background: var(--auth-primary);
  color: var(--theme-text-inverse, #ffffff);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--auth-primary) 28%, transparent);
}

.sf-page.sf-auth .sf-btn--primary:hover,
.sf-auth__card .sf-btn--primary:hover {
  background: var(--auth-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px color-mix(in srgb, var(--auth-primary-dark) 32%, transparent);
}

.sf-page.sf-auth .sf-btn--primary:active,
.sf-auth__card .sf-btn--primary:active {
  transform: translateY(0);
}

.sf-page.sf-auth .sf-btn--ghost,
.sf-auth__card .sf-btn--ghost {
  background: transparent;
  color: var(--auth-primary);
  border: 1.5px solid color-mix(in srgb, var(--auth-primary) 40%, var(--auth-line));
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 13.5px;
}

.sf-page.sf-auth .sf-btn--ghost:hover,
.sf-auth__card .sf-btn--ghost:hover {
  background: color-mix(in srgb, var(--auth-primary) 10%, #fff);
  border-color: var(--auth-primary);
  color: var(--auth-primary-dark);
}

.sf-btn__icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
}

.sf-btn__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Footer links */
.sf-auth__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: center;
  margin-top: 22px;
  font-family: var(--auth-font);
  font-size: 14px;
  color: var(--auth-muted);
}

.sf-auth__links a {
  color: var(--auth-heading, #2A2118) !important;
  font-weight: 700;
  text-decoration: none;
}

.sf-auth__links a:hover {
  color: var(--auth-primary);
  text-decoration: underline;
}

/* Account nav (change-password) */
.sf-auth__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 22px;
}

.sf-auth__nav a {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--auth-line);
  background: var(--auth-surface);
  font-family: var(--auth-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--auth-muted);
  text-decoration: none;
}

.sf-auth__nav a.is-active {
  background: var(--auth-primary);
  border-color: var(--auth-primary);
  color: var(--theme-text-inverse, #fff);
}

.sf-auth__orders {
  display: grid;
  gap: 0.75rem;
}

.sf-auth__order {
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  padding: 1rem;
  background: var(--auth-surface);
}

.sf-auth__order-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-weight: 600;
}

.sf-auth__empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--auth-muted);
}

@media (max-width: 520px) {
  .sf-page.sf-auth {
    padding: 28px 14px 48px;
    align-items: flex-start;
  }

  .sf-auth__card {
    padding: 28px 18px 22px;
  }

  .sf-auth__title {
    font-size: 24px;
  }

  .sf-auth__field input {
    min-height: 48px;
  }
}

/* Account pages (profile / orders layout) */
.t1-account-page {
  width: 100%;
  padding: 32px 24px 48px;
  background: #ffffff;
}

.t1-account-grid {
  display: grid;
  grid-template-columns: 256px 1fr;
  gap: 20px;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
}

.t1-account-sidebar,
.t1-account-content {
  background: var(--theme-surface, #fff);
  border: 1px solid var(--theme-border, #d9d9d4);
  border-radius: var(--theme-radius, 10px);
  box-shadow: var(--theme-shadow, 0 2px 8px rgba(0, 0, 0, 0.06));
  box-sizing: border-box;
}

.t1-account-sidebar {
  padding: 20px 16px;
}

.t1-account-content {
  padding: 28px 30px;
  min-width: 0;
}

.t1-account-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--theme-border, #d9d9d4);
}

.t1-account-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--theme-primary, #00b72f);
  color: var(--theme-text-inverse, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--theme-font-family, Inter, system-ui, sans-serif);
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--theme-primary, #00b72f) 28%, transparent);
}

.t1-account-user-info { min-width: 0; }

.t1-account-name {
  font-family: var(--theme-font-family, Inter, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: var(--theme-text, #2a2118);
  margin: 0 0 2px;
}

.t1-account-email {
  font-size: 12px;
  color: var(--theme-muted, #5f6f69);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.t1-account-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.t1-account-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-family: var(--theme-font-family, Inter, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--theme-text-secondary, #1f3f3a);
  text-decoration: none;
  border-radius: var(--theme-radius, 8px);
  transition: background 0.18s, color 0.18s;
}

.t1-account-nav-link:hover {
  background: color-mix(in srgb, var(--theme-primary, #00b72f) 10%, transparent);
  color: var(--theme-text, #2a2118);
}

.t1-account-nav-link.active {
  background: color-mix(in srgb, var(--theme-primary, #00b72f) 14%, transparent);
  color: var(--theme-accent-dark, #008f25);
  font-weight: 700;
}

.t1-account-nav-form {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--theme-border, #d9d9d4);
}

.t1-account-logout {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--theme-font-family, Inter, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--theme-danger, #b91c1c);
  padding: 10px 12px;
  border-radius: var(--theme-radius, 8px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.t1-account-logout:hover {
  background: color-mix(in srgb, var(--theme-danger, #b91c1c) 10%, transparent);
}

.t1-profile-title,
.t1-orders-title {
  font-family: var(--theme-font-family, Inter, system-ui, sans-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--theme-text, #2a2118);
  margin: 0 0 4px;
}

.t1-account-page .t1-auth-btn,
.t1-account-page button[type="submit"] {
  background: var(--theme-primary, #00b72f) !important;
  border-color: transparent !important;
  color: var(--theme-text-inverse, #fff) !important;
  border-radius: var(--theme-radius, 10px) !important;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--theme-primary, #00b72f) 28%, transparent) !important;
}

.t1-account-page .t1-auth-btn:hover,
.t1-account-page button[type="submit"]:hover {
  background: var(--theme-accent-dark, #008f25) !important;
}

@media (max-width: 720px) {
  .t1-account-grid { grid-template-columns: 1fr; }
}

.sf-auth__field-error {
  margin: 0;
  font-family: var(--theme-font-family, Inter, system-ui, sans-serif);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--theme-danger, #b91c1c);
}

.sf-auth__field-error[hidden] {
  display: none !important;
}

.sf-auth__field.is-invalid input,
.sf-auth__field input.is-invalid,
.t1-profile__field.is-invalid input,
.t1-profile__field input.is-invalid {
  border-color: var(--theme-danger, #b91c1c) !important;
  background: color-mix(in srgb, var(--theme-danger, #b91c1c) 8%, #fff) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-danger, #b91c1c) 18%, transparent) !important;
}


/* Auth contrast lock — titles/labels stay dark on cream cards */
.sf-page.sf-auth .sf-auth__title,
.sf-page.sf-auth .sf-auth__field label {
  color: #2A2118 !important;
}
.sf-page.sf-auth .sf-auth__lede,
.sf-page.sf-auth .sf-auth__muted,
.sf-page.sf-auth .sf-auth__switch {
  color: #6b5f54 !important;
}
.sf-page.sf-auth .sf-auth__field input,
.sf-page.sf-auth .sf-auth__field select,
.sf-page.sf-auth .sf-auth__field textarea {
  color: #2A2118 !important;
}