/* ===================================================
   BIBLIA EXTENDIDA — Auth Pages (registro, login)
   Requiere que app.css esté cargado primero
   =================================================== */

/* ── Layout ───────────────────────────────────────── */
.auth-main {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

/* Variante sin header: ocupa el 100% del viewport */
.auth-main--full {
  min-height: 100vh;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1rem 2.5rem;
}

/* ── Theme toggle button ──────────────────────────── */
.btn-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-theme-toggle:hover {
  color: var(--gold);
  border-color: var(--gold-border);
  background: var(--gold-dim);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 480px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card), 0 0 60px rgba(201,169,110,0.04);
  animation: slideUp 0.35s var(--ease);
}

/* ── Títulos ──────────────────────────────────────── */
.auth-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.auth-subtitle {
  color: var(--text-2);
  font-size: 0.88rem;
  margin-bottom: 2rem;
}

/* ── Alert ────────────────────────────────────────── */
.auth-alert {
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  display: none;
}
.auth-alert.visible  { display: block; }
.auth-alert.success  { background: rgba(93,184,122,0.12); border: 1px solid rgba(93,184,122,0.30); color: #7dda8a; }
.auth-alert.error    { background: rgba(224,112,112,0.12); border: 1px solid rgba(224,112,112,0.30); color: #e07070; }

/* ── Campo de formulario ──────────────────────────── */
.form-group { margin-bottom: 1.15rem; }

.form-label {
  display: block;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.form-input {
  width: 100%;
  background: rgba(0,0,0,0.32);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  outline: none;
  -webkit-appearance: none;
  text-align: center;
}
/* Anula el padding grande de input[type="text"] de app.css (pensado para la búsqueda con íconos) */
input[type="text"].form-input,
input[type="email"].form-input,
input[type="password"].form-input,
input[type="tel"].form-input {
  padding: 0.75rem 1rem;
}
/* Ocultar el botón de autocompletar del navegador en todos los temas */
.form-input::-webkit-contacts-auto-fill-button,
.form-input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  display: none !important;
  pointer-events: none;
  width: 0;
  height: 0;
}
.form-input::placeholder { color: var(--text-3); }
.form-input:focus {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1);
}
.form-input.error { border-color: rgba(224,112,112,0.6); }
.form-input.valid { border-color: rgba(93,184,122,0.5); }

/* ── Phone combo (selector país + número) ────────── */
.phone-combo {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.phone-combo:focus-within {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.1);
}
.phone-combo.error { border-color: rgba(224,112,112,0.6); }

.phone-country-wrapper { position: relative; flex-shrink: 0; }

.phone-country-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0,0,0,0.22);
  border: none;
  border-right: 1px solid var(--border);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-sans);
  padding: 0.72rem 0.8rem;
  white-space: nowrap;
  height: 100%;
  transition: background 0.2s var(--ease);
}
.phone-country-btn:hover { background: rgba(255,255,255,0.06); }
.phone-country-btn .chevron { color: var(--text-3); flex-shrink: 0; transition: transform 0.2s var(--ease); }
.phone-country-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
#country-flag { font-size: 1.1rem; line-height: 1; }
#country-code { font-size: 0.82rem; font-weight: 500; color: var(--text-2); min-width: 34px; }

.phone-number-input {
  border: none !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  flex: 1;
  min-width: 0;
  box-shadow: none !important;
  background: transparent;
}

/* Dropdown */
.phone-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 400;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  width: 260px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.18s var(--ease);
}
/* Asegurar que hidden siempre oculte el dropdown aunque CSS defina display:flex */
.phone-dropdown[hidden] { display: none !important; }
.phone-search-wrap {
  padding: 0.55rem 0.55rem 0.35rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.phone-search {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.83rem;
  outline: none;
  padding: 0.42rem 0.7rem;
  transition: border-color 0.2s var(--ease);
}
.phone-search::placeholder { color: var(--text-3); }
.phone-search:focus { border-color: var(--gold-border); }

#phone-country-list {
  overflow-y: auto;
  flex: 1;
  list-style: none;
  padding: 0.25rem 0;
}
.phone-group-label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0.55rem 0.85rem 0.2rem;
  pointer-events: none;
}
.phone-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  cursor: pointer;
  transition: background 0.1s var(--ease);
}
.phone-option:hover { background: var(--gold-dim); }
.po-flag { font-size: 1.05rem; flex-shrink: 0; }
.po-name { font-size: 0.82rem; color: var(--text); flex: 1; }
.po-code { font-size: 0.78rem; color: var(--text-3); white-space: nowrap; }
.phone-no-results { text-align: center; color: var(--text-3); font-size: 0.82rem; padding: 1rem; }

/* Light mode */
[data-theme="light"] .phone-country-btn { background: rgba(0,0,0,0.04); }
[data-theme="light"] .phone-country-btn:hover { background: rgba(0,0,0,0.07); }
[data-theme="light"] .phone-dropdown { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
[data-theme="light"] .phone-search { background: rgba(0,0,0,0.04); }
[data-theme="light"] .phone-number-input { background: transparent; }

/* ── Error hint ───────────────────────────────────── */
.form-error {
  display: none;
  color: #e07070;
  font-size: 0.78rem;
  margin-top: 0.35rem;
  padding-left: 0.1rem;
}
.form-error.visible { display: block; }

/* ── Password visibility toggle ───────────────────── */
.password-wrapper { position: relative; }
.password-wrapper .form-input { padding-right: 2.8rem; padding-left: 2.8rem; }

.btn-toggle-pass {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0.2rem;
  line-height: 0;
  transition: color 0.2s var(--ease);
}
.btn-toggle-pass:hover { color: var(--gold); }

/* ── Password strength bar ────────────────────────── */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  margin-top: 0.55rem;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.35s var(--ease), background-color 0.35s var(--ease);
}
.strength-label {
  font-size: 0.75rem;
  font-weight: 500;
  min-height: 1.2em;
  margin-top: 0.3rem;
  transition: color 0.2s var(--ease);
}

/* ── Requirements checklist ───────────────────────── */
.req-list {
  list-style: none;
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.5rem;
}
.req-item {
  font-size: 0.75rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s var(--ease);
}
.req-item.met { color: #7dda8a; }
.req-item::before {
  content: '○';
  font-size: 0.6rem;
  flex-shrink: 0;
}
.req-item.met::before { content: '✓'; }

/* ── Submit button ────────────────────────────────── */
.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--gold) 0%, #a0782b 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.9rem 1.5rem;
  transition: opacity 0.2s var(--ease), transform 0.1s var(--ease), box-shadow 0.2s var(--ease);
  margin-top: 0.75rem;
  position: relative;
  overflow: hidden;
}
.btn-submit:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 4px 20px rgba(201,169,110,0.3);
}
.btn-submit:active:not(:disabled) { transform: scale(0.99); }
.btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

/* Loading spinner inside button */
.btn-submit .spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer link ──────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 1.75rem;
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 2;
}
.auth-footer a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.auth-footer a:hover { border-bottom-color: var(--gold); }
.auth-footer .sep { color: var(--text-3); margin: 0 0.5rem; }

/* ── Divider ──────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text-3);
  font-size: 0.78rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 520px) {
  .auth-card { padding: 2rem 1.25rem; }
  .auth-title { font-size: 1.5rem; }
  .req-list { grid-template-columns: 1fr; }
}

/* ── "¿Olvidaste tu contraseña?" link ────────────── */
.forgot-link-wrap {
  text-align: center;
  margin-top: 0.9rem;
}
.btn-forgot {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-sans);
  transition: color 0.2s;
}
.btn-forgot:hover { color: var(--gold); }

/* ── Panel recuperar contraseña ─────────────────── */
.forgot-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 1rem;
}
.forgot-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0 0 1.25rem;
}
.forgot-success-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 0.5rem;
}
.forgot-success-msg {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ── Logo dentro de auth-card (solo login sin header) ── */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}
.auth-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.auth-logo-name {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1;
}
.auth-logo-sub {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.6em;
  text-transform: uppercase;
  margin-top: 0.1rem;
  padding-left: 0.6em; /* Compensar el letter-spacing visual */
}
