/* ==============================================
   HIDER · auth.css
   Ubicado en: frontend/css/auth.css
   Descripción: Estilos para la página de autenticación (login y registro).
   Login · Registro · página de autenticación
   ============================================== */

/* ── Layout ──────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - var(--header-h) - 40px);
}

/* ── Visual izquierdo ────────────────────────── */
.auth-visual {
  position: relative;
  overflow: hidden;
  min-height: 500px;
}

.auth-visual__img {
  position: absolute;
  inset: 0;
}

.auth-visual__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-visual__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(30, 18, 8, 0.55),
    rgba(91, 66, 52, 0.72)
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
}

.auth-logo__img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.auth-quote {
  color: var(--cream);
}

.auth-quote p {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 300;
  line-height: 1.4;
  font-style: italic;
}

.auth-quote em {
  font-style: normal;
  color: var(--gold-light);
}

/* ── Panel derecho ───────────────────────────── */
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--white);
  overflow-y: auto;
}

.auth-box {
  width: 100%;
  max-width: 420px;
}

/* ── Tabs ────────────────────────────────────── */
.auth-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 36px;
}

.auth-tab {
  flex: 1;
  padding: 14px 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration), border-color var(--duration);
}

.auth-tab:hover { color: var(--brown); }

.auth-tab.active {
  color: var(--brown);
  border-bottom-color: var(--brown);
}

/* ── Formulario ──────────────────────────────── */
.auth-form__head {
  margin-bottom: 28px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.5vw, 34px);
  font-weight: 400;
  color: var(--brown-deep);
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 14px;
  color: var(--muted);
}

/* Campos */
.field {
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.field-link {
  font-size: 12px;
  color: var(--brown);
  transition: opacity var(--duration);
}

.field-link:hover { opacity: 0.7; }

.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Input con ojo */
.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-right: 44px;
  width: 100%;
}

.input-eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  transition: color var(--duration);
  display: flex;
  align-items: center;
}

.input-eye:hover { color: var(--brown); }

/* Fuerza contraseña */
.password-strength {
  height: 3px;
  background: var(--line-soft);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.password-strength__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.4s var(--ease), background 0.4s;
}

.password-strength__bar.weak   { width: 33%; background: var(--sale); }
.password-strength__bar.medium { width: 66%; background: #f59e0b; }
.password-strength__bar.strong { width: 100%; background: #16a34a; }

.password-strength__label {
  font-size: 11px;
  margin-top: 4px;
  color: var(--muted);
  min-height: 16px;
}

/* Checkbox términos */
.field-check-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.field-check-box input {
  width: 16px;
  height: 16px;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  transition: border-color var(--duration), background var(--duration);
  position: relative;
}

.field-check-box input:checked {
  border-color: var(--brown);
  background: var(--brown);
}

.field-check-box input:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid var(--cream);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.field-check-box a {
  color: var(--brown);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Error */
.auth-error {
  background: rgba(220, 53, 34, 0.08);
  color: var(--sale);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* Botón social */
.btn-social {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--white);
  transition: border-color var(--duration),
              background var(--duration),
              box-shadow var(--duration);
}

.btn-social:hover {
  border-color: var(--brown);
  background: var(--cream-soft);
  box-shadow: var(--shadow-sm);
}

/* Footer note */
.auth-footer-note {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line-soft);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 860px) {
  .auth-main {
    grid-template-columns: 1fr;
  }

  .auth-visual { display: none; }

  .auth-panel {
    padding: 40px 24px;
    align-items: flex-start;
  }

  .auth-box { max-width: 100%; }
}

@media (max-width: 480px) {
  .fields-row {
    grid-template-columns: 1fr;
  }

  .auth-panel { padding: 28px 20px; }
}

/* ── OTP ─────────────────────────────────────── */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 28px 0;
}

.otp-input {
  width: 52px;
  min-width: 0;
  height: 58px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--brown-deep);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  outline: none;
  transition: border-color var(--duration), box-shadow var(--duration);
  background: var(--white);
}

.otp-input:focus {
  border-color: var(--brown);
  box-shadow: 0 0 0 4px rgba(91, 66, 52, 0.08);
}

.otp-input.filled {
  border-color: var(--brown);
  background: var(--cream-soft);
}

/* ── Fix tablet: mostrar imagen en iPad Air+ ─── */
@media (min-width: 768px) and (max-width: 860px) {
  .auth-main {
    grid-template-columns: 0.8fr 1fr;
  }
  .auth-visual { display: block; }
}

/* ── Email + código inline ───────────────────── */
.email-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.email-code-row .input { flex: 1; }

.btn-send-code {
  flex-shrink: 0;
  padding: 12px 16px;
  border: 1.5px solid var(--brown);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--brown);
  white-space: nowrap;
  transition: all var(--duration);
  background: var(--white);
}

.btn-send-code:hover {
  background: var(--brown);
  color: var(--cream);
}

.btn-send-code:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Phone field ─────────────────────────────── */
.field-optional {
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.phone-row {
  display: flex;
  gap: 8px;
}

.phone-prefix {
  flex-shrink: 0;
  width: 140px;
  /* Mismos estilos que .input */
  padding: 14px 32px 14px 14px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
  /* Flecha personalizada */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235B4234' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.phone-prefix:focus {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(91, 66, 52, 0.08);
}

.phone-row .input {
  flex: 1;
  min-width: 0;
}

.phone-custom-prefix {
  flex-shrink: 0 !important;
  flex: 0 0 80px !important;
  width: 80px !important;
  min-width: 0;
  text-align: center;
}

[data-theme="dark"] .phone-prefix {
  background-color: var(--surface);
  border-color: var(--line);
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0876f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ── OTP inline ──────────────────────────────── */
.otp-inline {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--cream-soft);
  border-radius: var(--r);
  border: 1.5px solid var(--line-soft);
  animation: searchFadeIn 0.3s var(--ease-out) both;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
}

.otp-inline .otp-inputs {
  margin: 0 0 8px 0;
  gap: 6px;
  justify-content: space-between;
}

.otp-inline .otp-input {
  flex: 1 1 0px;
  min-width: 0;
  max-width: 49px;
  height: 40px;
  font-size: 18px;
  border-radius: var(--r-sm);
  width: 0;
}

.otp-inline__status {
  font-size: 12px;
  min-height: 0;
}

.otp-inline__status.ok    { color: #16a34a; }
.otp-inline__status.error { color: var(--sale); }

/* ── Modal "Recuperar contraseña" ────────────── */
.forgot-modal {
  background: var(--white);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(12px);
  opacity: 0;
  transition: transform 0.3s var(--ease-out), opacity 0.25s var(--ease);
  overflow: hidden;
}

.modal-scrim.open .forgot-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.forgot-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
}

.forgot-modal__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--brown-deep);
}

.forgot-modal__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background var(--duration), color var(--duration);
  flex-shrink: 0;
}

.forgot-modal__close:hover {
  background: var(--cream-dark);
  color: var(--brown);
}

.forgot-modal__body {
  padding: 20px 28px;
}

.forgot-modal__desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  margin-bottom: 20px;
}

.forgot-modal__foot {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 4px 28px 24px;
}

.forgot-modal__success {
  text-align: center;
  padding: 12px 0 8px;
}

.forgot-modal__icon {
  font-size: 40px;
  margin-bottom: 12px;
  line-height: 1;
}

.forgot-modal__success p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 6px;
}

.forgot-modal__success span {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.75;
}

/* Responsive */
@media (max-width: 480px) {
  .forgot-modal {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
  }
  .modal-scrim.open .forgot-modal {
    transform: translateY(0);
    opacity: 1;
  }
  .forgot-modal__head,
  .forgot-modal__body,
  .forgot-modal__foot { padding-left: 20px; padding-right: 20px; }
  .forgot-modal__foot { flex-direction: column-reverse; }
  .forgot-modal__foot .btn { width: 100%; justify-content: center; }
}

/* ══ DARK MODE — auth ══ */

/* Panel y caja — mismo fondo para no crear el "bloque" visible */
[data-theme="dark"] .auth-panel    { background: var(--surface); }
[data-theme="dark"] .auth-box      { background: transparent; box-shadow: none; }

/* Títulos y textos */
[data-theme="dark"] .auth-title    { color: var(--text); }
[data-theme="dark"] .auth-sub      { color: var(--muted); }
[data-theme="dark"] .field-label   { color: var(--muted); }
[data-theme="dark"] .field-link    { color: var(--gold-light); }

/* Tabs */
[data-theme="dark"] .auth-tabs         { border-bottom-color: var(--line); }
[data-theme="dark"] .auth-tab          { color: var(--muted); }
[data-theme="dark"] .auth-tab.active   { color: var(--gold-light); border-bottom-color: var(--gold-light); }
[data-theme="dark"] .auth-tab:hover    { color: var(--gold-light); }

/* Divider "o continúa con" */
[data-theme="dark"] .auth-divider       { color: var(--muted); }
[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after { background: var(--line); }

/* Checkbox términos */
[data-theme="dark"] .field-check-box   { color: var(--muted); }
[data-theme="dark"] .field-check-box input { border-color: var(--border); background: var(--surface-2); }

/* Barra de fortaleza de contraseña */
[data-theme="dark"] .password-strength { background: var(--surface-2); }

/* Error */
[data-theme="dark"] .auth-error {
  background: rgba(192, 67, 42, 0.12);
}

/* Footer */
[data-theme="dark"] .auth-footer-note  { color: var(--muted); background: var(--bg); border-top-color: var(--line); }

/* OTP inputs */
[data-theme="dark"] .otp-input {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}
[data-theme="dark"] .otp-input:focus {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 4px rgba(196, 149, 106, 0.12);
}
[data-theme="dark"] .otp-input.filled {
  border-color: var(--gold-light);
  background: var(--surface-2);
}

/* OTP inline (bloque de verificación de email) */
[data-theme="dark"] .otp-inline {
  background: var(--surface-2);
  border-color: var(--line);
}

/* Botón social Google */
[data-theme="dark"] .btn-social {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}
[data-theme="dark"] .btn-social:hover {
  background: var(--border);
  border-color: var(--muted);
}

/* Botón enviar código */
[data-theme="dark"] .btn-send-code {
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-2);
}
[data-theme="dark"] .btn-send-code:hover {
  background: var(--brown);
  border-color: var(--brown);
  color: var(--cream);
}

/* Modal recuperar contraseña */
[data-theme="dark"] .forgot-modal {
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
[data-theme="dark"] .forgot-modal__title { color: var(--text); }
[data-theme="dark"] .forgot-modal__desc  { color: var(--muted); }
[data-theme="dark"] .forgot-modal__close { color: var(--muted); }
[data-theme="dark"] .forgot-modal__close:hover {
  background: var(--surface-2);
  color: var(--text);
}
[data-theme="dark"] .forgot-modal__success p,
[data-theme="dark"] .forgot-modal__success span { color: var(--muted); }