/* ========================================
   AUTHENTICATION PAGE STYLES
======================================== */

/* Auth Page Layout */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  position: relative;
  overflow-x: hidden;
}

/* Background Ambient Effect */
.auth-ambient {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    circle at 50% 30%,
    var(--color-surface-mixed) 0%,
    transparent 50%
  );
  pointer-events: none;
  z-index: 0;
}

/* Top Controls */
.auth-top-controls {
  position: fixed;
  inset-block-start: var(--space-md);
  inset-inline: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

/* Back to Home Link */
.back-home {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-smooth);

  &::after {
    display: none;
  }

  & :is(svg, i) {
    inline-size: 20px;
    block-size: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  &:hover {
    color: var(--color-accent);
    transform: translateX(-4px);
  }
}

/* Auth Container */
.auth-container {
  position: relative;
  z-index: 1;
  inline-size: 100%;
  max-inline-size: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);

  /* Auth Logo */
  & .auth-logo {
    inline-size: 80px;
    block-size: 80px;
    color: var(--color-accent);
    filter: drop-shadow(var(--glow-accent));
    animation: float 6s ease-in-out infinite;
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* Auth Card */
.auth-card {
  inline-size: 100%;
  background: var(--color-bg-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-elev-2);
}

/* Auth Header */
.auth-header {
  text-align: center;
  margin-block-end: var(--space-lg);

  & h1 {
    font-family: var(--font-title);
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--color-text-primary);
    margin-block-end: var(--space-xs);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
  }

  & p {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: 0;
    line-height: var(--leading-normal);
  }
}

/* ========================================
   ALERT MESSAGES
======================================== */

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  padding-inline: var(--space-md);
  background: var(--color-danger-soft);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  margin-block-end: var(--space-md);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  animation: slideDown 0.3s var(--ease-smooth);

  &.success {
    background: var(--color-success-soft);
    border-color: var(--color-success);

    & .alert-icon {
      color: var(--color-success);
    }
  }

  & .alert-icon {
    inline-size: 20px;
    block-size: 20px;
    flex-shrink: 0;
    color: var(--color-danger);
    display: flex;
    align-items: center;
    justify-content: center;

    & i {
      font-size: 18px;
    }
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   FORM STYLES
======================================== */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  letter-spacing: var(--tracking-wide);
}

.form-input {
  inline-size: 100%;
  padding-block: var(--space-sm);
  padding-inline: var(--space-md);
  background: var(--color-bg-0);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: var(--text-md);
  transition: all var(--duration-fast) var(--ease-smooth);

  &::placeholder {
    color: var(--color-text-muted);
  }

  &:focus {
    outline: none;
    border-color: var(--color-accent-soft);
    background: var(--color-bg-1);
    box-shadow: 0 0 0 3px var(--color-accent-soft);
  }

  &:invalid:not(:placeholder-shown) {
    border-color: var(--color-danger);
  }
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Password Input Wrapper */
.password-input-wrapper {
  position: relative;
}

.password-input-wrapper {
  & .form-input {
    padding-inline-end: 48px;
  }

  & :is(.toggle-password, .toggle-password-confirm) {
    position: absolute;
    inset-inline-end: var(--space-sm);
    inset-block-start: 50%;
    transform: translateY(-50%);
    inline-size: 36px;
    block-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-smooth);

    &:hover {
      color: var(--color-accent);
    }

    & :is(svg, i) {
      inline-size: 20px;
      block-size: 20px;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}

/* Form Options (Remember Me, Forgot Password) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;

  & input[type="checkbox"] {
    inline-size: 18px;
    block-size: 18px;
    accent-color: var(--color-accent);
    cursor: pointer;
  }

  & span {
    line-height: 1.4;
  }
}

/* Inline Links */
.inline-link {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);

  &::after {
    display: none;
  }

  &:hover {
    color: var(--color-accent-glow);
    text-decoration: underline;
  }
}

/* Forgot Password Link */
.forgot-link {
  font-size: var(--text-sm);
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-smooth);
  white-space: nowrap;

  &::after {
    display: none;
  }

  &:hover {
    color: var(--color-accent-glow);
    text-decoration: underline;
  }
}

/* ========================================
   SUBMIT BUTTON
======================================== */

.btn-submit {
  inline-size: 100%;
  padding-block: var(--space-sm);
  padding-inline: var(--space-lg);
  background: var(--color-accent);
  color: var(--color-bg-0);
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--duration-mid) var(--ease-smooth);
  position: relative;
  overflow: hidden;

  &:hover:not(:disabled) {
    background: var(--color-accent-glow);
    transform: translateY(-2px);
    box-shadow: var(--glow-accent);
  }

  &:active:not(:disabled) {
    transform: translateY(0);
  }

  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
}

/* Button Loading State */
.btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  inline-size: 20px;
  block-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;

  & :is(svg, i) {
    inline-size: 20px;
    block-size: 20px;
    font-size: 20px;
  }

  /* Custom SVG spinner logic */
  & circle {
    stroke-dasharray: 50;
    stroke-dashoffset: 25;
  }
}

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

/* ========================================
   DIVIDER
======================================== */

.auth-divider {
  position: relative;
  text-align: center;
  margin-block: var(--space-lg);

  &::before {
    content: '';
    position: absolute;
    inset-block-start: 50%;
    inset-inline: 0;
    block-size: 1px;
    background: var(--color-border-subtle);
  }

  & span {
    position: relative;
    display: inline-block;
    padding-inline: var(--space-md);
    background: var(--color-bg-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}

/* ========================================
   SOCIAL LOGIN
======================================== */

.social-login {
  display: flex;
  gap: var(--space-sm);
}

.btn-social {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  padding-inline: var(--space-md);
  background: var(--color-bg-0);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-button);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);

  &:hover {
    background: var(--color-bg-2);
    border-color: var(--color-accent-soft);
    transform: translateY(-2px);
  }

  & :is(svg, i) {
    inline-size: 20px;
    block-size: 20px;
    font-size: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ========================================
   AUTH FOOTER
======================================== */

.auth-footer {
  text-align: center;
  margin-block-start: var(--space-lg);
  padding-block-start: var(--space-lg);
  border-block-start: 1px solid var(--color-border-subtle);

  & p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: 0;
  }

  & .auth-link {
    color: var(--color-accent);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-smooth);

    &::after {
      display: none;
    }

    &:hover {
      color: var(--color-accent-glow);
      text-decoration: underline;
    }
  }
}

/* ========================================
   MODAL
======================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s var(--ease-smooth);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  inline-size: 100%;
  max-inline-size: 440px;
  background: var(--color-bg-1);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elev-2);
  animation: slideUp 0.3s var(--ease-smooth);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-block-end: 1px solid var(--color-border-subtle);

  & h2 {
    font-family: var(--font-title);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-tight);
    color: var(--color-text-primary);
    margin: 0;
  }

  & .modal-close {
    inline-size: 32px;
    block-size: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-smooth);

    &:hover {
      background: var(--color-bg-0);
      color: var(--color-text-primary);
    }

    & :is(svg, i) {
      inline-size: 20px;
      block-size: 20px;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}

.modal-body {
  padding: var(--space-lg);
}

.modal-body p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

/* ========================================
   RESPONSIVE
======================================== */

@media (width <= 600px) {
  .auth-card {
    padding: var(--space-lg);
  }

  .auth-header h1 {
    font-size: var(--text-lg);
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
  }

  .social-login {
    flex-direction: column;
  }

  .back-home span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-logo {
    animation: none;
  }
}
