/* LEXGO — Acceso de clientes: botón de la esquina superior derecha y ventana
 * de inicio de sesión / registro.
 *
 * Vive aparte de styles.css a propósito: el botón se inyecta por JavaScript en
 * todas las páginas, así que su estilo se actualiza sin tocar la hoja principal.
 */

/* ═══════════════ Botón de la barra ═══════════════ */

.lx-acct { position: relative; display: flex; align-items: center; }

/* En las páginas de chat (lexia.html, chat.html) la barra no tiene contenedor
 * de acciones: el botón se va solo hasta el borde derecho. */
.chat-topbar > .lx-acct { margin-left: auto; }

.lx-acct-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  background: transparent;
  color: #E6EDF4;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.lx-acct-btn:hover { border-color: var(--gold); color: var(--gold); }
.lx-acct-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Estado con sesión iniciada: iniciales en un círculo dorado + nombre. */
.lx-acct-btn.on { padding-left: 6px; }

.lx-acct-ini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold), #B8912A);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .02em;
  flex-shrink: 0;
}

.lx-acct-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lx-acct-caret { width: 14px; height: 14px; opacity: .7; }

/* En pantallas angostas solo queda el círculo, para no competir con el menú. */
@media (max-width: 720px) {
  .lx-acct-btn { padding: 0 10px; }
  .lx-acct-btn.on { padding: 0 6px; }
  .lx-acct-name, .lx-acct-caret { display: none; }
  .lx-acct-btn:not(.on) .lx-acct-txt { display: none; }
}

/* ═══════════════ Menú desplegable ═══════════════ */

.lx-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 232px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 400;
}
.lx-menu[hidden] { display: none; }

.lx-menu-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 6px;
}
.lx-menu-head strong {
  display: block;
  font-size: 14.5px;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lx-menu-head span {
  display: block;
  font-size: 12.5px;
  color: var(--gray);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lx-menu a, .lx-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  transition: background .15s;
}
.lx-menu a:hover, .lx-menu button:hover { background: var(--light); }
.lx-menu svg { width: 17px; height: 17px; color: var(--gray); flex-shrink: 0; }
.lx-menu .lx-salir { color: var(--danger); }
.lx-menu .lx-salir svg { color: var(--danger); }

/* ═══════════════ Ventana de acceso ═══════════════ */

.lx-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(13, 27, 42, .62);
  backdrop-filter: blur(3px);
}
.lx-modal[hidden] { display: none; }

.lx-card {
  position: relative;
  width: 100%;
  max-width: 412px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px 28px 26px;
}

.lx-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  border-radius: 8px;
  color: var(--gray);
  cursor: pointer;
}
.lx-close:hover { background: var(--light); color: var(--navy); }
.lx-close svg { width: 20px; height: 20px; }

.lx-card h2 {
  font-family: var(--font-display);
  font-size: 25px;
  color: var(--navy);
  margin: 0 0 4px;
}
.lx-card .lx-sub {
  font-size: 14px;
  color: var(--gray);
  margin: 0 0 20px;
  line-height: 1.5;
}

.lx-tabs {
  display: flex;
  gap: 4px;
  background: var(--light);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.lx-tabs button {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: none;
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.lx-tabs button.on {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.lx-field { margin-bottom: 14px; }
.lx-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}
.lx-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--navy);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
}
.lx-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.lx-submit {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.lx-submit:hover { background: var(--blue-dark); }
.lx-submit:disabled { opacity: .6; cursor: default; }

.lx-forgot {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--gray);
  text-align: center;
  cursor: pointer;
}
.lx-forgot:hover { color: var(--blue); text-decoration: underline; }

.lx-msg {
  margin: 0 0 16px;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 13.5px;
  line-height: 1.45;
}
.lx-msg[hidden] { display: none; }
.lx-msg.error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.lx-msg.ok { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }

.lx-legal {
  margin: 16px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--gray);
  text-align: center;
}
.lx-legal a { color: var(--blue); text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   Mi cuenta (cuenta.html): plan, consumo, historial y ajustes
   ═══════════════════════════════════════════════════════════ */

.cu-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

/* ---------- Estados de carga / sin sesión ---------- */

.cu-cargando, .cu-sinsesion { text-align: center; padding: 72px 20px; }
.cu-cargando p { color: var(--gray); font-size: 14.5px; margin-top: 14px; }

.cu-spinner {
  width: 30px; height: 30px; margin: 0 auto;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: cu-giro .8s linear infinite;
}
@keyframes cu-giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cu-spinner { animation-duration: 3s; } }

.cu-sinsesion h1 { font-family: var(--font-display); font-size: 28px; color: var(--navy); margin: 0 0 10px; }
.cu-sinsesion p { color: var(--gray); font-size: 15px; margin: 0 0 24px; }

/* ---------- Cabecera de perfil ---------- */

.cu-perfil { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }

.cu-avatar {
  width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold), #B8912A);
  color: var(--navy); font-size: 22px; font-weight: 800;
}
.cu-perfil h1 { font-family: var(--font-display); font-size: 26px; color: var(--navy); margin: 0; }
.cu-perfil p { color: var(--gray); font-size: 14.5px; margin: 2px 0 0; word-break: break-all; }

/* ---------- Tarjetas ---------- */

.cu-tarjeta {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  margin-bottom: 18px;
}
.cu-tarjeta-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.cu-tarjeta h2 { font-family: var(--font-body); font-size: 16px; font-weight: 700; color: var(--navy); margin: 0; }

.cu-chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.cu-chip-ok { background: #ECFDF5; color: #047857; }
.cu-chip-gris { background: var(--light); color: var(--gray); }
.cu-chip-oro { background: var(--gold-soft); color: #7A5D0B; }
.cu-estado-activa { background: #EFF6FF; color: #1D4ED8; }
.cu-estado-esperando { background: var(--gold-soft); color: #7A5D0B; }
.cu-estado-hecha { background: #ECFDF5; color: #047857; }
.cu-estado-fallida { background: #FEF2F2; color: #991B1B; }

/* ---------- Plan y consumo ---------- */

.cu-plan-nombre { font-family: var(--font-display); font-size: 24px; color: var(--navy); margin: 0; }
.cu-plan-renueva { font-size: 13px; color: var(--gray); margin: 4px 0 0; }

.cu-uso { margin-top: 18px; }
.cu-uso[hidden] { display: none; }
.cu-uso-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; margin-bottom: 7px;
}
.cu-uso-head span:first-child { color: var(--navy); font-weight: 600; }
.cu-uso-head span:last-child { color: var(--gray); }

.cu-barra { height: 8px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.cu-barra-relleno {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--blue); transition: width .4s ease;
}
.cu-barra-relleno.casi { background: var(--gold); }
.cu-barra-relleno.llena { background: var(--danger); }

.cu-nota { font-size: 12.5px; color: var(--gray); margin: 16px 0 18px; }
.cu-ancho { display: block; width: 100%; text-align: center; }

/* ---------- Listas de historial ---------- */

.cu-lista { display: flex; flex-direction: column; gap: 8px; }

.cu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  transition: border-color .15s, background .15s;
}
a.cu-item:hover { border-color: var(--blue); background: #FAFBFF; }

.cu-item-cuerpo { flex: 1; min-width: 0; }
.cu-item-cuerpo strong {
  display: block; font-size: 14px; font-weight: 600; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cu-item-cuerpo span { display: block; font-size: 12.5px; color: var(--gray); margin-top: 3px; }

.cu-vacio { font-size: 14px; color: var(--gray); margin: 0; padding: 8px 0; }
.cu-vacio a { color: var(--blue); font-weight: 600; }

/* ---------- Configuración ---------- */

.cu-campo { margin-bottom: 14px; }
.cu-campo label { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.cu-campo input {
  width: 100%; height: 44px; padding: 0 13px;
  border: 1px solid var(--gray-300); border-radius: 10px;
  font-family: var(--font-body); font-size: 15px; color: var(--navy);
  background: var(--white);
}
.cu-campo input:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}
.cu-campo input:disabled { background: var(--light); color: var(--gray); }
.cu-hint { display: block; font-size: 12px; color: var(--gray); margin-top: 5px; }

.cu-cfg-fila { display: flex; align-items: flex-end; gap: 10px; }
.cu-cfg-fila .cu-campo { flex: 1; margin-bottom: 14px; }
.cu-cfg-fila .btn { margin-bottom: 14px; white-space: nowrap; }

.cu-cfg-accion {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 16px; margin-top: 4px;
  border-top: 1px solid var(--gray-200);
}
.cu-cfg-accion strong { display: block; font-size: 14px; color: var(--navy); }
.cu-cfg-accion span { display: block; font-size: 12.5px; color: var(--gray); margin-top: 2px; }
.cu-peligro { color: var(--danger); border-color: #FECACA; }
.cu-peligro:hover { background: #FEF2F2; }

.cu-msg { padding: 11px 13px; border-radius: 9px; font-size: 13.5px; margin: 0 0 16px; }
.cu-msg[hidden] { display: none; }
.cu-msg.error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.cu-msg.ok { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }

.cu-pie { font-size: 12px; color: var(--gray); text-align: center; line-height: 1.6; margin: 26px 0 0; }
.cu-pie a { color: var(--blue); text-decoration: underline; }

/* ---------- Distintivo de plan en el menú del botón ---------- */

.lx-plan {
  display: inline-block; margin-top: 8px; padding: 3px 9px;
  border-radius: 999px; background: var(--gold-soft); color: #7A5D0B;
  font-size: 11px; font-weight: 700;
}
.lx-plan[hidden] { display: none; }

@media (max-width: 560px) {
  .cu-cfg-fila { flex-direction: column; align-items: stretch; }
  .cu-cfg-fila .btn { margin-bottom: 0; }
  .cu-cfg-accion { flex-direction: column; align-items: flex-start; }
}

/* ---------- Lexia cerrada: aviso dentro del chat ---------- */

.lexia-cerrado {
  align-self: center;
  max-width: 460px;
  margin: 18px auto 8px;
  padding: 20px 22px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.lexia-cerrado p {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--navy);
}
.lexia-cerrado a {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.lexia-cerrado a:hover { background: var(--blue-dark); }

/* ============================================================
   REGISTRO — autorizaciones legales, erratas de correo y reenvío
   (añadido el 16 de agosto de 2026)
   ============================================================ */

/* ---------- Las tres casillas de la Ley 1581 ---------- */

.lx-legales {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin: 4px 0 18px;
  padding: 14px 14px 15px;
  background: #F8FAFC;
  border: 1px solid var(--gray-200, #E5E7EB);
  border-radius: 11px;
}
.lx-legales.falta {
  border-color: #FCA5A5;
  background: #FEF7F7;
}

.lx-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 12.5px;
  line-height: 1.5;
  color: #4B5563;
  cursor: pointer;
}
.lx-check input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--blue, #2563EB);
  cursor: pointer;
  flex-shrink: 0;
}
.lx-check a { color: var(--blue, #2563EB); text-decoration: underline; }
.lx-check a:hover { color: var(--blue-dark, #1D4ED8); }

/* ---------- "¿Quisiste decir …@gmail.com?" ---------- */

.lx-sugerencia {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 9px;
  font-size: 13px;
  color: #92400E;
}
.lx-sugerencia[hidden] { display: none; }
.lx-sugerencia span { flex: 1 1 100%; font-weight: 600; }
.lx-sug-si, .lx-sug-no {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
}
.lx-sug-si { background: #92400E; color: #fff; }
.lx-sug-si:hover { background: #78350F; }
.lx-sug-no { background: transparent; color: #92400E; border-color: #FDE68A; }
.lx-sug-no:hover { border-color: #92400E; }

/* ---------- Reenviar el correo de confirmación ---------- */

.lx-reenvio {
  margin: 0 0 16px;
  padding: 13px 14px;
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 11px;
  text-align: center;
}
.lx-reenvio[hidden] { display: none; }
.lx-spam {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #075985;
}
.lx-reenviar {
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: var(--blue, #2563EB);
  border: none;
  border-radius: 9px;
  padding: 10px 20px;
  cursor: pointer;
}
.lx-reenviar:hover:not([disabled]) { background: var(--blue-dark, #1D4ED8); }
.lx-reenviar[disabled] { opacity: .55; cursor: default; }
