/* ============================================================
   Twingital Login Pro — Frontend CSS
   Usa CSS variables del sistema de diseño TDP + TLP
   ============================================================ */

/* ── Reset base ─────────────────────────────────────────── */
.tlp-wrap *,
.tlp-wrap *::before,
.tlp-wrap *::after { box-sizing: border-box; }

/* ── Wrapper principal ──────────────────────────────────── */
.tlp-wrap {
  font-family: var(--tlp-font, sans-serif);
  color: var(--tlp-card-text, #111);
  width: 100%;
}

/* ── Layout: centered (default) ────────────────────────── */
.tlp-layout-centered {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 60vh;
  padding: 2rem 1rem;
  background: var(--tlp-bg, #f4f1ec);
}

/* ── Layout: card flotante ──────────────────────────────── */
.tlp-layout-card {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
  background: var(--tlp-bg, #f4f1ec);
  padding: 2rem 1rem;
}

/* ── Layout: split ──────────────────────────────────────── */
.tlp-layout-split-left,
.tlp-layout-split-right {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 80vh;
}
.tlp-layout-split-left .tlp-split-deco  { order: 2; }
.tlp-layout-split-left .tlp-split-form  { order: 1; }
.tlp-layout-split-right .tlp-split-deco { order: 1; }
.tlp-layout-split-right .tlp-split-form { order: 2; }

.tlp-split-deco {
  background: linear-gradient(135deg, var(--tlp-primary, #2563eb) 0%, color-mix(in srgb, var(--tlp-primary, #2563eb) 60%, #000) 100%);
}
.tlp-split-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--tlp-bg, #f4f1ec);
}

/* ── Layout: fullscreen ─────────────────────────────────── */
.tlp-layout-fullscreen {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--tlp-primary, #2563eb);
}

/* ── Card del formulario ────────────────────────────────── */
.tlp-card {
  background: var(--tlp-card-bg, #fff);
  border-radius: var(--tlp-radius, 12px);
  box-shadow: var(--tlp-shadow, 0 4px 24px rgba(0,0,0,.08));
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: var(--tlp-form-width, 460px);
}

/* ── Logo ───────────────────────────────────────────────── */
.tlp-logo {
  display: block;
  max-width: 140px;
  max-height: 60px;
  margin: 0 auto 1.5rem;
  object-fit: contain;
}

/* ── Título ─────────────────────────────────────────────── */
.tlp-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 1.75rem;
  color: var(--tlp-card-text, #111);
}

/* ── Formulario ─────────────────────────────────────────── */
.tlp-form { width: 100%; }

.tlp-field {
  margin-bottom: 1.1rem;
}
.tlp-field label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--tlp-card-text, #111);
}

.tlp-input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--tlp-btn-radius, 8px);
  font-size: 1rem;
  font-family: var(--tlp-font, sans-serif);
  background: var(--tlp-card-bg, #fff);
  color: var(--tlp-card-text, #111);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.tlp-input:focus {
  border-color: var(--tlp-primary, #2563eb);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tlp-primary, #2563eb) 15%, transparent);
}
.tlp-input.tlp-error { border-color: #ef4444; }

/* ── Password wrapper (toggle) ──────────────────────────── */
.tlp-password-wrap {
  position: relative;
}
.tlp-password-wrap .tlp-input { padding-right: 2.6rem; }
.tlp-toggle-pass {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
}
.tlp-toggle-pass:hover { color: var(--tlp-primary, #2563eb); }

/* ── Password strength ───────────────────────────────────── */
.tlp-strength-bar {
  height: 4px;
  border-radius: 2px;
  margin-top: .4rem;
  background: #e2e8f0;
  overflow: hidden;
  transition: all .3s;
}
.tlp-strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s, background .3s;
  width: 0;
}
.tlp-strength-fill.weak   { background: #ef4444; width: 33%; }
.tlp-strength-fill.medium { background: #f59e0b; width: 66%; }
.tlp-strength-fill.strong { background: #22c55e; width: 100%; }
.tlp-strength-label { font-size: .75rem; color: #64748b; margin-top: .25rem; }

/* ── Checkbox row ───────────────────────────────────────── */
.tlp-check-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: #64748b;
}
.tlp-check-row input[type="checkbox"] { accent-color: var(--tlp-primary, #2563eb); }
.tlp-check-row a { color: var(--tlp-primary, #2563eb); }

/* ── Links menores ──────────────────────────────────────── */
.tlp-forgot-wrap {
  text-align: right;
  margin-top: -.5rem;
  margin-bottom: 1rem;
}
.tlp-link {
  font-size: .85rem;
  color: var(--tlp-primary, #2563eb);
  text-decoration: none;
}
.tlp-link:hover { text-decoration: underline; }

/* ── Botón principal ────────────────────────────────────── */
.tlp-btn {
  display: block;
  width: 100%;
  padding: .75rem 1rem;
  background: var(--tlp-btn-bg, var(--tlp-primary, #2563eb));
  color: var(--tlp-btn-text, #fff);
  border: none;
  border-radius: var(--tlp-btn-radius, 8px);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--tlp-font, sans-serif);
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  text-align: center;
}
.tlp-btn:hover:not(:disabled) { opacity: .9; }
.tlp-btn:active:not(:disabled) { transform: scale(.99); }
.tlp-btn:disabled { opacity: .6; cursor: not-allowed; }
.tlp-btn.tlp-btn-loading { position: relative; }

/* ── Separador ──────────────────────────────────────────── */
.tlp-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: #94a3b8;
  font-size: .85rem;
}
.tlp-divider::before,
.tlp-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ── Social buttons ─────────────────────────────────────── */
.tlp-social-wrap {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.tlp-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: .65rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--tlp-btn-radius, 8px);
  background: #fff;
  color: #374151;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: var(--tlp-font, sans-serif);
}
.tlp-social-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.tlp-social-btn svg  { flex-shrink: 0; }

/* ── Honeypot oculto ────────────────────────────────────── */
.tlp-hp { display: none !important; visibility: hidden; }

/* ── Mensajes ───────────────────────────────────────────── */
.tlp-message {
  padding: .75rem 1rem;
  border-radius: var(--tlp-btn-radius, 8px);
  font-size: .9rem;
  margin-bottom: 1rem;
  display: none;
}
.tlp-message.tlp-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; display: block; }
.tlp-message.tlp-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; display: block; }
.tlp-message a           { color: inherit; font-weight: 600; }

/* ── Footer del form (links) ────────────────────────────── */
.tlp-form-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .875rem;
  color: #64748b;
}
.tlp-form-footer a { color: var(--tlp-primary, #2563eb); font-weight: 600; text-decoration: none; }
.tlp-form-footer a:hover { text-decoration: underline; }

/* ── My Account widget ──────────────────────────────────── */
.tlp-my-account { display: inline-flex; align-items: center; gap: .5rem; position: relative; }
.tlp-account-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--tlp-primary, #2563eb);
}
.tlp-account-name { font-weight: 600; font-size: .9rem; cursor: pointer; }
.tlp-account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--tlp-card-bg, #fff);
  border-radius: var(--tlp-radius, 12px);
  box-shadow: var(--tlp-shadow, 0 4px 24px rgba(0,0,0,.12));
  padding: .5rem 0;
  display: none;
  z-index: 9999;
  border: 1px solid #e2e8f0;
}
.tlp-my-account:hover .tlp-account-dropdown,
.tlp-my-account.tlp-open .tlp-account-dropdown { display: block; }
.tlp-account-dropdown a {
  display: block;
  padding: .5rem 1rem;
  font-size: .9rem;
  color: var(--tlp-card-text, #111);
  text-decoration: none;
  transition: background .1s;
}
.tlp-account-dropdown a:hover { background: #f8fafc; }
.tlp-account-dropdown .tlp-logout-btn { color: #ef4444; }

.tlp-account-guest { display: flex; gap: .5rem; align-items: center; }
.tlp-account-guest .tlp-btn-ghost {
  padding: .45rem .9rem;
  border: 1.5px solid var(--tlp-primary, #2563eb);
  border-radius: var(--tlp-btn-radius, 8px);
  color: var(--tlp-primary, #2563eb);
  font-size: .875rem;
  font-weight: 600;
  background: transparent;
  text-decoration: none;
  transition: background .15s;
}
.tlp-account-guest .tlp-btn-ghost:hover { background: color-mix(in srgb, var(--tlp-primary, #2563eb) 8%, transparent); }
.tlp-account-guest .tlp-btn-solid {
  padding: .45rem .9rem;
  border-radius: var(--tlp-btn-radius, 8px);
  background: var(--tlp-btn-bg, var(--tlp-primary, #2563eb));
  color: var(--tlp-btn-text, #fff);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.tlp-account-guest .tlp-btn-solid:hover { opacity: .88; }

/* ── 2FA overlay ────────────────────────────────────────── */
.tlp-2fa-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}
.tlp-2fa-screen.tlp-active { display: flex; }
.tlp-2fa-box {
  background: var(--tlp-card-bg, #fff);
  border-radius: var(--tlp-radius, 12px);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  text-align: center;
}
.tlp-2fa-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.tlp-2fa-title { font-size: 1.2rem; font-weight: 700; margin-bottom: .5rem; }
.tlp-2fa-sub   { font-size: .875rem; color: #64748b; margin-bottom: 1.5rem; }
.tlp-2fa-code-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: .5rem;
  font-weight: 700;
}
.tlp-2fa-resend {
  display: block;
  margin-top: .75rem;
  font-size: .8rem;
  color: var(--tlp-primary, #2563eb);
  cursor: pointer;
  background: none;
  border: none;
}

/* ── reCAPTCHA notice (requerido por Google) ─────────── */
.tlp-recaptcha-notice {
  margin-top: 1.25rem;
  font-size: .72rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}
.tlp-recaptcha-notice a {
  color: #94a3b8;
  text-decoration: underline;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .tlp-layout-split-left,
  .tlp-layout-split-right {
    grid-template-columns: 1fr;
  }
  .tlp-split-deco { display: none; }
  .tlp-card { padding: 2rem 1.25rem; }
}

/* ============================================================
   PANEL DE PERFIL
   ============================================================ */

/* ── Wrapper ──────────────────────────────────────────────── */
.tlp-profile-wrap {
  font-family: var(--tlp-font, sans-serif);
  color: var(--tlp-card-text, #111);
  max-width: 680px;
}

/* ── Header ───────────────────────────────────────────────── */
.tlp-profile-header {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 1.5rem;
  background: var(--tlp-card-bg, #fff);
  border-radius: var(--tlp-radius, 12px);
  box-shadow: var(--tlp-shadow, 0 2px 12px rgba(0,0,0,.07));
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* ── Avatar ───────────────────────────────────────────────── */
.tlp-profile-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.tlp-profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: #e2e8f0;
  border: 3px solid var(--tlp-primary, #2563eb);
  flex-shrink: 0;
  position: relative;
}
.tlp-avatar-actions { display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.tlp-btn-avatar-upload {
  font-size: .78rem;
  font-weight: 600;
  color: var(--tlp-primary, #2563eb);
  cursor: pointer;
  padding: .3rem .7rem;
  border: 1.5px solid var(--tlp-primary, #2563eb);
  border-radius: 6px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.tlp-btn-avatar-upload:hover { background: var(--tlp-primary, #2563eb); color: #fff; }
.tlp-btn-avatar-remove {
  font-size: .75rem;
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--tlp-font, sans-serif);
}
.tlp-avatar-uploading { font-size: .8rem; color: #64748b; display: flex; align-items: center; gap: .4rem; }

/* ── Spinner ──────────────────────────────────────────────── */
.tlp-spinner {
  width: 14px; height: 14px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--tlp-primary, #2563eb);
  border-radius: 50%;
  animation: tlp-spin .6s linear infinite;
  display: inline-block;
}
@keyframes tlp-spin { to { transform: rotate(360deg); } }

/* ── Header info ──────────────────────────────────────────── */
.tlp-profile-name  { font-size: 1.3rem; font-weight: 800; margin: 0 0 .25rem; }
.tlp-profile-email { font-size: .875rem; color: #64748b; margin: 0 0 .2rem; }
.tlp-profile-via   { font-size: .8rem; color: #94a3b8; margin: 0; }

/* ── Tabs del perfil ──────────────────────────────────────── */
.tlp-profile-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid #e2e8f0;
  flex-wrap: wrap;
}
.tlp-profile-tab {
  padding: .6rem 1rem;
  font-size: .875rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  font-family: var(--tlp-font, sans-serif);
  position: relative;
  bottom: -2px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.tlp-profile-tab:hover { color: var(--tlp-primary, #2563eb); }
.tlp-profile-tab.tlp-active {
  color: var(--tlp-primary, #2563eb);
  border-bottom-color: var(--tlp-primary, #2563eb);
}
.tlp-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tlp-primary, #2563eb);
  color: #fff;
  border-radius: 10px;
  font-size: .7rem;
  font-weight: 700;
  padding: 0 .45rem;
  min-width: 18px;
  height: 18px;
  margin-left: .3rem;
}

/* ── Panels ───────────────────────────────────────────────── */
.tlp-profile-panel { display: none; }
.tlp-profile-panel.tlp-active { display: block; }

/* ── Form grid (nombre / apellido) ───────────────────────── */
.tlp-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* ── Field hint ───────────────────────────────────────────── */
.tlp-field-hint { font-size: .75rem; color: #94a3b8; margin: .25rem 0 0; }
.tlp-required { color: #ef4444; }

/* ── Secondary button ─────────────────────────────────────── */
.tlp-btn-secondary {
  padding: .5rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  background: var(--tlp-card-bg, #fff);
  color: var(--tlp-card-text, #111);
  cursor: pointer;
  font-family: var(--tlp-font, sans-serif);
  transition: border-color .15s, color .15s;
}
.tlp-btn-secondary:hover { border-color: var(--tlp-primary, #2563eb); color: var(--tlp-primary, #2563eb); }

/* ── Divider ──────────────────────────────────────────────── */
.tlp-profile-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 1.5rem 0;
}
.tlp-section-subtitle {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 1rem;
}
.tlp-section-desc { font-size: .9rem; color: #64748b; margin: 0 0 1.25rem; }

/* ── 2FA status row ───────────────────────────────────────── */
.tlp-2fa-status-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.tlp-2fa-on  { font-size: .9rem; color: #166534; font-weight: 600; }
.tlp-2fa-off { font-size: .9rem; color: #94a3b8; }
.tlp-2fa-enable-options { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Social cards ─────────────────────────────────────────── */
.tlp-social-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--tlp-radius, 12px);
  margin-bottom: .75rem;
  gap: 1rem;
  background: var(--tlp-card-bg, #fff);
}
.tlp-social-card-left { display: flex; align-items: center; gap: .85rem; }
.tlp-social-name      { font-weight: 700; font-size: .95rem; }
.tlp-social-status    { font-size: .82rem; margin-top: .15rem; display: flex; align-items: center; gap: .35rem; }
.tlp-social-linked    { color: #166534; }
.tlp-social-unlinked  { color: #94a3b8; }
.tlp-social-unavailable { font-size: .8rem; color: #cbd5e1; }
.tlp-social-tiny-avatar {
  width: 18px; height: 18px; border-radius: 50%; object-fit: cover;
}
.tlp-social-btn-sm {
  padding: .45rem .9rem;
  font-size: .82rem;
}

/* ── Review cards (historial) ─────────────────────────────── */
.tlp-reviews-list    { display: flex; flex-direction: column; gap: .85rem; }
.tlp-review-card {
  background: var(--tlp-card-bg, #fff);
  border: 1.5px solid #e2e8f0;
  border-radius: var(--tlp-radius, 12px);
  padding: 1rem 1.25rem;
}
.tlp-review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}
.tlp-review-listing-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--tlp-primary, #2563eb);
  text-decoration: none;
}
.tlp-review-listing-name:hover { text-decoration: underline; }
.tlp-review-card-meta  { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; }
.tlp-review-stars      { color: #f59e0b; letter-spacing: .05em; font-size: .9rem; }
.tlp-review-date       { font-size: .78rem; color: #94a3b8; }
.tlp-review-card-title   { font-weight: 700; font-size: .9rem; margin: 0 0 .3rem; }
.tlp-review-card-content { font-size: .875rem; color: #374151; margin: 0 0 .5rem; line-height: 1.6; }
.tlp-review-card-reply {
  font-size: .82rem;
  color: #64748b;
  padding: .5rem .75rem;
  background: #f8fafc;
  border-left: 3px solid var(--tlp-primary, #2563eb);
  border-radius: 0 6px 6px 0;
}
.tlp-review-status-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.tlp-status-approved { background: #f0fdf4; color: #166534; }
.tlp-status-pending  { background: #fef9c3; color: #854d0e; }
.tlp-status-rejected { background: #fef2f2; color: #991b1b; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 560px) {
  .tlp-profile-header { flex-direction: column; text-align: center; }
  .tlp-profile-grid   { grid-template-columns: 1fr; }
  .tlp-profile-tabs   { gap: 0; }
  .tlp-profile-tab    { font-size: .8rem; padding: .5rem .65rem; }
}

/* ── Avatar en formulario de registro ──────────────────── */
.tlp-reg-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.tlp-reg-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px dashed #e2e8f0;
  background: #f8fafc;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  transition: border-color .15s;
}
.tlp-reg-avatar-preview:has(~ * .tlp-btn-avatar-upload:hover),
.tlp-reg-avatar-wrap:hover .tlp-reg-avatar-preview {
  border-color: var(--tlp-primary, #2563eb);
}
.tlp-reg-avatar-placeholder { font-size: 2rem; line-height: 1; }
.tlp-reg-avatar-right { display: flex; flex-direction: column; gap: .25rem; }
