/* =============================================================
   DIGISTORES — AUTHENTICATION PAGE STYLES
   css/auth.css

   Styles for the login, registration and password reset pages.
   Builds on top of css/main.css which must be loaded first.

   SECTIONS:
   1.  Auth Page Layout
   2.  Auth Brand Panel (left side on desktop)
   3.  Auth Form Panel (right side / full on mobile)
   4.  Auth Header
   5.  Auth Tabs (Login / Register)
   6.  Auth Form Elements
   7.  Password Strength Indicator
   8.  Social Proof Elements
   9.  Role Selection Cards
   10. Success and Error States
   11. Responsive Styles
   ============================================================= */


/* =============================================================
   1. AUTH PAGE LAYOUT
   ============================================================= */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
}

.auth-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

/* =============================================================
   2. AUTH BRAND PANEL
   Left side on desktop — hidden on mobile
   ============================================================= */

.auth-brand {
  display: none;
  background: linear-gradient(145deg,
    #1A1040 0%,
    #2D1B69 30%,
    #6C63FF 70%,
    #00D4AA 100%
  );
  padding: var(--space-10);
  position: relative;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
}

.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0, 212, 170, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}

.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 99, 255, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

.auth-brand__content {
  position: relative;
  z-index: 1;
}

.auth-brand__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-12);
}

.auth-brand__logo-mark {
  width: 44px;
  height: 44px;
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--font-weight-extrabold);
  font-size: var(--font-size-base);
  letter-spacing: -0.05em;
  backdrop-filter: blur(8px);
}

.auth-brand__logo-text {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-extrabold);
  color: white;
  letter-spacing: var(--letter-spacing-tight);
}

.auth-brand__headline {
  font-size: clamp(1.75rem, 2.5vw, 2.5rem);
  font-weight: var(--font-weight-extrabold);
  color: white;
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-4);
}

.auth-brand__headline-accent {
  color: var(--color-accent);
}

.auth-brand__subtitle {
  font-size: var(--font-size-base);
  color: rgba(255, 255, 255, 0.75);
  line-height: var(--line-height-relaxed);
  max-width: 380px;
  margin: 0 0 var(--space-10);
}

/* Feature bullets on brand panel */
.auth-brand__features {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-brand__feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.auth-brand__feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background-color: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-brand__feature-text {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.85);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-snug);
}

/* Testimonial quote at bottom of brand panel */
.auth-brand__footer {
  position: relative;
  z-index: 1;
  margin-top: var(--space-10);
}

.auth-brand__quote {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  backdrop-filter: blur(8px);
}

.auth-brand__quote-text {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.85);
  line-height: var(--line-height-relaxed);
  font-style: italic;
  margin-bottom: var(--space-3);
}

.auth-brand__quote-author {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.6);
  font-weight: var(--font-weight-medium);
}

.auth-brand__quote-note {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.4);
  margin-top: var(--space-2);
  font-style: italic;
}


/* =============================================================
   3. AUTH FORM PANEL
   ============================================================= */

.auth-form-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

.auth-form-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.auth-form-panel__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.auth-form-panel__logo-mark {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: var(--font-weight-extrabold);
  font-size: var(--font-size-xs);
}

.auth-form-panel__logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-extrabold);
  color: var(--color-primary);
  letter-spacing: var(--letter-spacing-tight);
}

.auth-form-panel__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.auth-form-panel__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-8) var(--space-5) var(--space-10);
  overflow-y: auto;
}

.auth-form-container {
  width: 100%;
  max-width: 460px;
}


/* =============================================================
   4. AUTH HEADER
   ============================================================= */

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-header__title {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-extrabold);
  color: var(--text-primary);
  letter-spacing: var(--letter-spacing-tight);
  margin-bottom: var(--space-2);
}

.auth-header__subtitle {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0;
}


/* =============================================================
   5. AUTH TABS
   ============================================================= */

.auth-tabs {
  display: flex;
  background-color: var(--surface-2);
  border-radius: var(--radius-xl);
  padding: 4px;
  margin-bottom: var(--space-8);
  border: 1px solid var(--border-default);
}

.auth-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-base);
  text-align: center;
  white-space: nowrap;
  min-height: 44px;
}

.auth-tab:hover {
  color: var(--text-primary);
  background-color: var(--surface-3);
}

.auth-tab.active {
  background-color: var(--surface-1);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* Tab panels */
.auth-tab-panel {
  display: none;
}

.auth-tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}


/* =============================================================
   6. AUTH FORM ELEMENTS
   ============================================================= */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-form .form-group {
  margin-bottom: var(--space-5);
}

/* Password visibility toggle */
.password-input-wrapper {
  position: relative;
}

.password-input-wrapper .form-input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 1.125rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  line-height: 1;
}

.password-toggle:hover {
  color: var(--text-secondary);
}

/* Forgot password link */
.auth-forgot-link {
  font-size: var(--font-size-sm);
  color: var(--text-link);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  transition: var(--transition-fast);
  display: block;
  text-align: right;
  margin-top: calc(-1 * var(--space-3));
  margin-bottom: var(--space-5);
}

.auth-forgot-link:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

/* Auth submit button */
.auth-submit {
  width: 100%;
  margin-top: var(--space-2);
  min-height: 52px;
  font-size: var(--font-size-base);
  position: relative;
}

/* Auth switch text */
.auth-switch {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.auth-switch a,
.auth-switch button {
  color: var(--text-link);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  transition: var(--transition-fast);
}

.auth-switch a:hover,
.auth-switch button:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

/* Terms text */
.auth-terms {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  text-align: center;
  line-height: var(--line-height-relaxed);
  margin-top: var(--space-4);
}

.auth-terms a {
  color: var(--text-link);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
}

.auth-terms a:hover {
  text-decoration: underline;
}

/* Divider between sections */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-default);
}


/* =============================================================
   7. PASSWORD STRENGTH INDICATOR
   ============================================================= */

.password-strength {
  margin-top: var(--space-2);
}

.password-strength__bar {
  height: 4px;
  background-color: var(--surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-1);
}

.password-strength__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease, background-color 0.3s ease;
  width: 0%;
}

.password-strength__fill--weak    { background-color: var(--color-error); }
.password-strength__fill--fair    { background-color: var(--color-warning); }
.password-strength__fill--good    { background-color: var(--color-info); }
.password-strength__fill--strong  { background-color: var(--color-success); }

.password-strength__label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.password-strength__label--weak   { color: var(--color-error); }
.password-strength__label--fair   { color: var(--color-warning); }
.password-strength__label--good   { color: var(--color-info); }
.password-strength__label--strong { color: var(--color-success); }

.password-requirements {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.password-req {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  transition: var(--transition-fast);
}

.password-req.met {
  color: var(--color-success);
}

.password-req__icon {
  font-size: 0.75rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}


/* =============================================================
   8. ROLE SELECTION CARDS
   ============================================================= */

.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.role-card {
  border: 2px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  cursor: pointer;
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  background-color: var(--surface-1);
  position: relative;
  overflow: hidden;
}

.role-card:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  transform: translateY(-1px);
}

[data-theme="dark"] .role-card:hover {
  background-color: rgba(108, 99, 255, 0.1);
}

.role-card.selected {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

[data-theme="dark"] .role-card.selected {
  background-color: rgba(108, 99, 255, 0.15);
}

.role-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.role-card__check {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background-color: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  transition: var(--transition-base);
  flex-shrink: 0;
}

.role-card.selected .role-card__check {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.role-card__icon {
  font-size: 2rem;
  line-height: 1;
}

.role-card__title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.role-card__description {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  line-height: var(--line-height-snug);
  margin: 0;
}

.role-card.selected .role-card__title {
  color: var(--color-primary);
}


/* =============================================================
   9. PASSWORD RESET VIEW
   ============================================================= */

.auth-reset {
  display: none;
}

.auth-reset.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.auth-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: var(--space-6);
  transition: var(--transition-fast);
  font-family: var(--font-family-base);
}

.auth-back-btn:hover {
  color: var(--text-primary);
}


/* =============================================================
   10. SUCCESS AND ERROR STATES
   ============================================================= */

.auth-success-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.auth-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: var(--color-success-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: bounceIn 0.5s ease;
}

[data-theme="dark"] .auth-success-icon {
  background-color: rgba(16, 185, 129, 0.15);
}

.auth-success-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.auth-success-message {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  max-width: 340px;
  margin: 0;
}

/* General auth error banner */
.auth-error-banner {
  background-color: var(--color-error-light);
  border: 1px solid var(--color-error);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-error-dark);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  animation: fadeInDown 0.2s ease;
}

[data-theme="dark"] .auth-error-banner {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.auth-error-banner__icon {
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 1px;
}

/* Email verification notice */
.auth-verify-notice {
  background-color: var(--color-info-light);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-info-dark);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

[data-theme="dark"] .auth-verify-notice {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-info);
}


/* =============================================================
   11. RESPONSIVE STYLES
   ============================================================= */

@media (min-width: 768px) {
  .auth-layout {
    grid-template-columns: 1fr 1fr;
  }

  .auth-brand {
    display: flex;
  }

  .auth-form-panel__body {
    justify-content: center;
    padding: var(--space-10) var(--space-8);
  }
}

@media (min-width: 1024px) {
  .auth-layout {
    grid-template-columns: 55% 45%;
  }

  .auth-brand {
    padding: var(--space-12);
  }
}

@media (min-width: 1280px) {
  .auth-layout {
    grid-template-columns: 60% 40%;
  }
}