/* ============================================================
   AUTH.CSS — Self-contained Authentication Styles
   Incluye TODAS las variables, reset, orbs y componentes.
   NO depende de base.css — es completamente autónomo.
   ============================================================ */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---------- Variables ---------- */
:root {
  /* Brand Palette */
  --c-deep-teal:    #125154;
  --c-emerald:      #1A9880;
  --c-mint-light:   #D9F0EE;
  --c-dark-forest:  #004949;
  --c-sage:         #379C88;
  --c-frost:        #C5DEDC;
  --c-green-mid:    #088A6D;
  --c-cyan:         #64CADC;
  --c-teal-bright:  #00A6B1;

  /* Semantic */
  --bg-body:        #0a0f1a;
  --bg-body-alt:    #0d1425;
  --surface-glass:  rgba(18, 81, 84, 0.12);
  --surface-glass-hover: rgba(26, 152, 128, 0.16);
  --border-glass:   rgba(100, 202, 220, 0.15);
  --border-glass-hover: rgba(100, 202, 220, 0.30);

  --text-primary:   #D9F0EE;
  --text-secondary: #90b8b4;
  --text-muted:     #5a8a84;
  --text-accent:    #64CADC;

  /* Spacing */
  --sp-xs:  0.25rem;
  --sp-sm:  0.5rem;
  --sp-md:  1rem;
  --sp-lg:  1.5rem;
  --sp-xl:  2rem;
  --sp-2xl: 3rem;
  --sp-3xl: 4rem;

  /* Radius */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-pill: 100px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.20);
  --shadow-md:  0 4px 20px rgba(0, 0, 0, 0.30);
  --shadow-lg:  0 8px 40px rgba(0, 0, 0, 0.40);
  --shadow-glow: 0 0 30px rgba(100, 202, 220, 0.15);

  /* Transitions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:   150ms var(--ease-smooth);
  --t-normal: 250ms var(--ease-smooth);
  --t-slow:   400ms var(--ease-smooth);

  /* Fonts */
  --font-display: 'Outfit', sans-serif;
  --font-body:    'DM Sans', sans-serif;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Body ---------- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

p {
  color: var(--text-secondary);
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--c-mint-light);
}

a:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- Background Orbs ---------- */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-orbs::before,
.bg-orbs::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
}

.bg-orbs::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--c-emerald), transparent 70%);
  top: -10%;
  left: -8%;
  animation: orbFloat1 18s ease-in-out infinite alternate;
}

.bg-orbs::after {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--c-cyan), transparent 70%);
  bottom: -10%;
  right: -8%;
  animation: orbFloat2 20s ease-in-out infinite alternate;
}

.bg-orbs .orb-extra {
  position: absolute;
  width: 350px;
  height: 350px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.2;
  background: radial-gradient(circle, var(--c-teal-bright), transparent 70%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 22s ease-in-out infinite alternate;
}

@keyframes orbFloat1 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.1); }
}
@keyframes orbFloat2 {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-50px, -30px) scale(1.08); }
}
@keyframes orbFloat3 {
  0%   { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-45%, -55%) scale(1.15); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(100, 202, 220, 0.15);
  border-radius: var(--r-pill);
}

/* ============================================================
   AUTH LAYOUT
   ============================================================ */

.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ---------- Left panel ---------- */
.auth__left {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3xl);
  position: relative;
  overflow: hidden;
}

.auth__left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(18, 81, 84, 0.25) 0%,
    rgba(10, 15, 26, 0.6) 50%,
    rgba(0, 73, 73, 0.2) 100%
  );
  z-index: 0;
}

.left__content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}

.left__back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: var(--sp-2xl);
  transition: color var(--t-fast);
  padding: 6px 0;
}
.left__back:hover { color: var(--text-accent); }
.left__back svg {
  width: 18px;
  height: 18px;
  transition: transform var(--t-fast);
}
.left__back:hover svg { transform: translateX(-3px); }

.left__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-2xl);
  text-decoration: none;
}

.left__brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--c-emerald), var(--c-cyan));
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.left__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-primary);
}

.left__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--sp-lg);
  color: var(--text-primary);
}

.left__title-accent {
  background: linear-gradient(135deg, var(--c-mint-light), var(--c-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.left__subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-xl);
}

.left__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.left__meta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-emerald);
  flex-shrink: 0;
}

.left__features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  margin-top: var(--sp-xl);
}

.left__feature {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.left__feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: rgba(26, 152, 128, 0.12);
  border: 1px solid rgba(26, 152, 128, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* ---------- Right panel ---------- */
.auth__right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2xl);
  position: relative;
}

/* ---------- Auth Card ---------- */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-xl);
  padding: var(--sp-2xl);
  box-shadow: var(--shadow-lg);
  animation: authCardIn 0.5s var(--ease-smooth) forwards;
}

.auth-card--signup {
  max-width: 480px;
}

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

.auth-card__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
  text-decoration: none;
}

.auth-card__brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--c-emerald), var(--c-cyan));
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.auth-card__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.auth-card__header {
  text-align: center;
  margin-bottom: var(--sp-xl);
}

.auth-card__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-xs);
}

.auth-card__subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.field__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field__input-wrap {
  position: relative;
}

.field__input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: rgba(10, 15, 26, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-md);
  transition: all var(--t-fast);
  outline: none;
}

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

.field__input:focus {
  border-color: var(--c-cyan);
  box-shadow: 0 0 0 3px rgba(100, 202, 220, 0.12);
  background: rgba(10, 15, 26, 0.65);
}

.field__input:hover:not(:focus) {
  border-color: rgba(100, 202, 220, 0.25);
}

.field__input--has-toggle {
  padding-right: 48px;
}

/* Toggle password button */
.field__toggle-pw {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.field__toggle-pw:hover { color: var(--text-accent); }
.field__toggle-pw:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 1px;
}
.field__toggle-pw svg { width: 18px; height: 18px; }

/* Validation states */
.field__input.is-invalid {
  border-color: rgba(255, 120, 100, 0.5);
}
.field__input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(255, 120, 100, 0.1);
}
.field__input.is-valid {
  border-color: rgba(26, 152, 128, 0.5);
}

/* Field error */
.field__error {
  font-size: 0.78rem;
  color: #ff7864;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all var(--t-normal);
}
.field__error.visible {
  min-height: 18px;
  max-height: 40px;
  opacity: 1;
  margin-top: 2px;
}
.field__error svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Two-column field row */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}

/* ============================================================
   PASSWORD STRENGTH METER
   ============================================================ */

.pw-strength {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.pw-strength__bar {
  display: flex;
  gap: 4px;
  height: 4px;
}

.pw-strength__segment {
  flex: 1;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  transition: background var(--t-fast);
}

.pw-strength[data-level="1"] .pw-strength__segment:nth-child(1) { background: #ff7864; }
.pw-strength[data-level="2"] .pw-strength__segment:nth-child(-n+2) { background: #ffc14d; }
.pw-strength[data-level="3"] .pw-strength__segment:nth-child(-n+3) { background: var(--c-emerald); }
.pw-strength[data-level="4"] .pw-strength__segment:nth-child(-n+4) { background: var(--c-cyan); }

.pw-strength__text {
  font-size: 0.72rem;
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.pw-strength[data-level="1"] .pw-strength__text { color: #ff7864; }
.pw-strength[data-level="2"] .pw-strength__text { color: #ffc14d; }
.pw-strength[data-level="3"] .pw-strength__text { color: var(--c-emerald); }
.pw-strength[data-level="4"] .pw-strength__text { color: var(--c-cyan); }

/* ============================================================
   CHECKBOX
   ============================================================ */

.check-field {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
}

.check-field__input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  background: rgba(10, 15, 26, 0.5);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--t-fast);
  position: relative;
}

.check-field__input:checked {
  background: linear-gradient(135deg, var(--c-emerald), var(--c-green-mid));
  border-color: var(--c-emerald);
}

.check-field__input:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check-field__input:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 1px;
}

.check-field__label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.check-field__label a {
  color: var(--text-accent);
  text-decoration: underline;
  text-decoration-color: rgba(100, 202, 220, 0.3);
  text-underline-offset: 2px;
}
.check-field__label a:hover {
  text-decoration-color: var(--text-accent);
}

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

.auth-submit {
  width: 100%;
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--c-emerald), var(--c-green-mid));
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-normal);
  box-shadow: 0 4px 16px rgba(26, 152, 128, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-submit:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(26, 152, 128, 0.45);
  transform: translateY(-1px);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 2px;
}

.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-submit .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.auth-submit.is-loading .spinner {
  display: inline-block;
}

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

/* ============================================================
   DIVIDER, FOOTER, FLASH, FORGOT
   ============================================================ */

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-top: var(--sp-xl);
}

.auth-divider__line {
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

.auth-divider__text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.auth-footer {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: var(--sp-md);
}

.auth-footer a {
  color: var(--text-accent);
  font-weight: 600;
}
.auth-footer a:hover { color: var(--c-mint-light); }

.field__forgot {
  font-size: 0.8rem;
  color: var(--text-accent);
  font-weight: 500;
}
.field__forgot:hover { color: var(--c-mint-light); }

/* Flash messages */
.auth-flash {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
  animation: flashIn 0.3s var(--ease-smooth) forwards;
}

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

.auth-flash--error {
  background: rgba(255, 120, 100, 0.1);
  border: 1px solid rgba(255, 120, 100, 0.2);
  color: #ff8a78;
}

.auth-flash--success {
  background: rgba(26, 152, 128, 0.1);
  border: 1px solid rgba(26, 152, 128, 0.2);
  color: var(--c-emerald);
}

.auth-flash svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Signup checks spacing */
.signup-checks {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

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

@media (max-width: 992px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth__left {
    display: none;
  }

  .auth__right {
    padding: var(--sp-xl) var(--sp-lg);
    min-height: 100vh;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: var(--sp-xl) var(--sp-lg);
    border-radius: var(--r-lg);
  }

  .auth-card__title {
    font-size: 1.3rem;
  }
}