/* ============================================
   AUTH PAGES SHARED STYLES (Login & Register)
   comfytee – Premium D2C
   ============================================ */

/* Full-page loader: shown until DOM ready, and on nav click for instant feedback */
.auth-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-black, #0a0a0a);
  opacity: 1;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.auth-page-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.auth-page-loader-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-accent-primary, #00ff88);
  border-radius: 50%;
  animation: authLoaderSpin 0.7s linear infinite;
}

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

/* Page wrapper */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2rem 1.5rem;
  overflow-x: hidden;
}

/* Background */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--color-black);
}

.auth-bg-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 255, 136, 0.12) 0%, transparent 50%), radial-gradient(ellipse 60% 40% at 100% 100%, rgba(107, 159, 255, 0.08) 0%, transparent 50%), radial-gradient(ellipse 50% 30% at 0% 80%, rgba(255, 107, 157, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.auth-bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* Main container */
.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  animation: authFadeIn 0.6s ease-out;
}

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

/* Card – no background on mobile; with background on PC */
.auth-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 2.5rem 2rem;
  box-shadow: none;
}

/* Left panel: logo, tagline, title, alt CTA (shown on PC; on mobile part of flow) */
.auth-card-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-tagline {
  font-size: 0.9375rem;
  color: var(--color-text-tertiary);
  font-weight: 500;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

.auth-alt-btn {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-accent-primary);
  background: transparent;
  border: 1px solid var(--color-accent-primary);
  border-radius: 10px;
  text-decoration: none;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
  margin-top: 1rem;
}

.auth-alt-btn:hover {
  background: rgba(0, 255, 136, 0.12);
  color: var(--color-accent-primary);
  transform: translateY(-1px);
}

/* Brand name (left panel only, shown on PC) */
.auth-brand-name {
  display: none;
}

/* Features list & stat – hidden on mobile */
.auth-left-features,
.auth-left-stat {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

.auth-left-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.auth-left-feature:last-child {
  margin-bottom: 0;
}

.auth-left-feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(0, 255, 136, 0.1);
  color: var(--color-accent-primary);
}

.auth-left-stat {
  flex-direction: column;
  align-items: flex-start;
  padding-top: 1.25rem;
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-left-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-accent-primary);
  line-height: 1.2;
}

.auth-left-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* Right panel: form only (always present) */
.auth-card-right {
  width: 100%;
}

/* PC: two boxes side by side */
@media (min-width: 769px) {
  .auth-container {
    max-width: 880px;
    width: 100%;
  }

  .auth-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  }

  .auth-card-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2.25rem 2rem;
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.98) 0%, rgba(20, 20, 20, 0.96) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-right: none;
    border-radius: 16px 0 0 16px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: relative;
    overflow: hidden;
  }

  .auth-card-left::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--color-accent-primary) 50%, transparent 100%);
    opacity: 0.5;
  }

  .auth-brand-name {
    display: inline;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    margin-left: 0.5rem;
  }

  .auth-brand {
    flex-direction: row;
    margin-bottom: 1rem;
  }

  .auth-tagline {
    font-size: 0.8125rem;
    margin-bottom: 1.25rem;
    color: var(--color-text-tertiary);
    letter-spacing: 0.03em;
  }

  .auth-heading {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 0 1.35rem 1.25rem;
    border-left: 3px solid var(--color-accent-primary);
    border-bottom: none;
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.06) 0%, transparent 100%);
    border-radius: 0 8px 8px 0;
    position: relative;
  }

  .auth-heading::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
  }

  .auth-title {
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    color: var(--color-text-primary);
    background: linear-gradient(135deg, #ffffff 0%, rgba(255, 255, 255, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .auth-subtitle {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--color-text-tertiary);
    font-weight: 500;
    letter-spacing: 0.02em;
    max-width: 260px;
  }

  .auth-left-features {
    display: block;
    margin-bottom: 0;
  }

  .auth-left-stat {
    display: flex;
  }

  .auth-alt-btn {
    margin-top: 1.5rem;
  }

  .auth-card-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.25rem 2rem;
    background: linear-gradient(180deg, rgba(28, 28, 28, 0.96) 0%, rgba(24, 24, 24, 0.94) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 16px 16px 0;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: relative;
  }

  .auth-card-right::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 255, 136, 0.4) 50%, transparent 100%);
    opacity: 0.6;
  }

  .auth-card-right .auth-form {
    width: 100%;
    max-width: 320px;
  }

  .auth-card-right .auth-field .input-field {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .auth-card-right .auth-field .input-field:focus {
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
  }

  .auth-card-right .auth-phone-unified {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .auth-card-right .auth-field.focused .auth-phone-unified,
  .auth-card-right .auth-phone-unified:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.15);
  }

  .auth-card-right .auth-phone-national {
    padding: 0.75rem 1rem 0.75rem 0.625rem;
    font-size: 0.9375rem;
  }

  .auth-card-right .auth-phone-prefix {
    padding-left: 1rem;
    font-size: 0.9375rem;
  }

  .auth-card-right .auth-password-wrap .input-field.auth-password-input {
    padding: 0.75rem 2.65rem 0.75rem 1rem;
  }

  .auth-card-right .auth-btn {
    border-radius: 12px;
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .auth-footer {
    display: none;
  }

  .auth-alt-btn {
    display: inline-flex;
  }

  .auth-card-left {
    align-items: flex-start;
    text-align: left;
  }

  .auth-brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .auth-field {
    margin-bottom: 0.875rem;
  }

  .auth-field .input-label {
    font-size: 0.625rem;
    margin-bottom: 0.375rem;
  }

  .auth-field .input-field {
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border-radius: 10px;
  }

  .auth-btn {
    margin-top: 0.375rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    border-radius: 10px;
  }

  .auth-checkbox {
    font-size: 0.75rem;
  }

  .auth-link {
    font-size: 0.8125rem;
  }
}

/* Brand block – logo only */
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.auth-brand-logo {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.2) 0%, rgba(107, 159, 255, 0.1) 100%);
  color: var(--color-accent-primary);
}

/* Heading */
.auth-heading {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
  margin-bottom: 0.35rem;
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--color-text-tertiary);
  font-weight: 500;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.auth-field {
  margin-bottom: 1.25rem;
}

.auth-field .input-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 0.5rem;
  transition: color var(--transition-fast);
}

.auth-field .input-field {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--color-text-primary);
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
}

.auth-field .input-field:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.auth-field .input-field:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.auth-field .input-field::placeholder {
  color: var(--color-text-tertiary);
  opacity: 0.6;
}

/* Unified phone: single border, fixed +91 (register + login) */
.auth-phone-unified {
  display: flex;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  gap: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
}

.auth-phone-unified:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.auth-field.focused .auth-phone-unified,
.auth-phone-unified:focus-within {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.auth-phone-prefix {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding-left: 1rem;
  padding-right: 0.625rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  background: transparent;
}

.auth-phone-divider {
  width: 1px;
  align-self: stretch;
  margin: 0.65rem 0;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.auth-phone-national {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.875rem 1rem 0.875rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text-primary);
  border-radius: 0;
}

.auth-phone-national::placeholder {
  color: var(--color-text-tertiary);
  opacity: 0.6;
}

.auth-phone-national:focus {
  outline: none;
}

/* Password field + visibility toggle (login + register) */
.auth-password-wrap {
  position: relative;
  width: 100%;
  z-index: 0;
}

.auth-password-wrap .input-field.auth-password-input {
  padding-right: 2.75rem;
  position: relative;
  z-index: 0;
}

.auth-password-toggle {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.auth-password-toggle:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.auth-password-toggle:focus-visible {
  outline: none;
  color: var(--color-accent-primary);
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.25);
}

.auth-password-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.auth-password-toggle-icon svg {
  display: block;
}

/* Checkbox (shared) */
.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.7rem;
}

.auth-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.auth-checkbox-box {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.2s,
    background 0.2s;
  position: relative;
}

.auth-checkbox input:checked + .auth-checkbox-box {
  border-color: var(--color-accent-primary);
  background: var(--color-accent-primary);
}

.auth-checkbox input:checked + .auth-checkbox-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid var(--color-black);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-checkbox-text {
  color: var(--color-text-secondary);
}

.auth-checkbox:hover .auth-checkbox-text {
  color: var(--color-text-primary);
}

.auth-link {
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color 0.2s;
}

.auth-link:hover {
  color: var(--color-accent-primary);
}

/* Primary button */
.auth-btn {
  width: 100%;
  margin-top: 0.5rem;
  padding: 1rem 1.5rem;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: var(--color-accent-primary);
  color: var(--color-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    opacity 0.2s;
}

.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 255, 136, 0.25);
}

.auth-btn:active {
  transform: translateY(0);
}

.auth-btn.loading {
  pointer-events: none;
  opacity: 0.85;
}

/* Footer */
.auth-footer {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-footer-text {
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
  margin-bottom: 0.5rem;
}

.auth-footer-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-accent-primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.auth-footer-link:hover {
  opacity: 0.9;
  text-decoration: underline;
}

/* Mobile */
@media (max-width: 768px) {
  .auth-page {
    padding: 1.25rem 1rem;
    align-items: center;
  }

  .auth-card {
    padding: 1.75rem 1.25rem;
  }

  .auth-tagline {
    display: none;
  }

  .auth-brand {
    margin-bottom: 1.5rem;
  }

  .auth-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .auth-heading {
    margin-bottom: 1.5rem;
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .auth-subtitle {
    font-size: 0.875rem;
  }

  .auth-field {
    margin-bottom: 1rem;
  }

  .auth-field .input-field {
    padding: 0.75rem 1rem;
  }

  .auth-phone-national {
    padding: 0.75rem 1rem 0.75rem 0.625rem;
  }

  .auth-phone-prefix {
    padding-left: 1rem;
  }

  .auth-btn {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
  }

  .auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
  }
}
