/* ============================================================
   Zona de usuarios — estilos de la página de cuenta
   (se apoya en mkt.css: variables, nav, footer, botones, .fg…)
   ============================================================ */

/* El cuerpo ocupa toda la altura y empuja el pie hasta abajo: si el contenido es corto
   (p. ej. una cuenta recién registrada, sin pedidos ni direcciones), antes quedaba un
   hueco gris entre el pie y el fondo de la página. */
.cuenta-body { background: #f4f6f9; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.cuenta-main {
  flex: 1 0 auto; /* absorbe el espacio sobrante para que el pie quede pegado abajo */
  width: 100%;    /* ancho FIJO: antes se encogía al contenido de cada pestaña (720, 789, 824 px…) y al
                     cambiar de pestaña todo el bloque se recolocaba, como si la página se refrescara */
  max-width: 1000px;
  margin: 0 auto;
  padding: 104px 20px 60px; /* la nav es fija (72px): deja hueco arriba */
  min-height: 60vh;
}
#cuentaApp { width: 100%; }
.cuenta-loading { text-align: center; color: #6b7280; padding: 60px 0; }

/* El contenido de la pestaña mantiene una altura mínima. Así, al pasar de «Mis pedidos» a «Mis
   datos» o «Seguridad» la página no se encoge ni da un salto, y los estados «Cargando…» o
   «Aún no tienes pedidos» ocupan un área de verdad en lugar de una caja diminuta que luego crece
   de golpe. */
#panel { min-height: 420px; }

/* Mientras se carga una pestaña se atenúa lo que ya había en lugar de vaciarlo: así el panel no se
   queda en una línea («Cargando…») y la página no encoge ni vuelve a crecer. */
#panel.is-loading { opacity: .45; }

/* ── Tarjeta genérica ── */
.panel-card {
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* ── Autenticación ── */
.auth-wrap { max-width: 440px; margin: 20px auto 0; }
.auth-card { background: #fff; border: 1px solid var(--line-2); border-radius: 18px; padding: 32px; box-shadow: var(--shadow-md); }
.auth-card h2 { font-size: 20px; font-weight: 800; color: var(--dark); margin-bottom: 4px; }
.auth-card .sub { color: #6b7280; font-size: 13px; margin-bottom: 22px; }
.auth-tabs { display: flex; gap: 6px; background: #eef1f6; padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px 12px; border-radius: 9px;
  font-weight: 700; font-size: 14px; color: #4b5563; cursor: pointer; font-family: inherit;
}
.auth-tabs button.is-active { background: #fff; color: var(--dark); box-shadow: var(--shadow-sm); }
.auth-card .fg { margin-bottom: 14px; }
.auth-card .btn { width: 100%; margin-top: 8px; }
.auth-alt { text-align: center; margin-top: 16px; font-size: 13px; line-height: 1.9; }
.auth-alt a { color: var(--green-dark); font-weight: 600; cursor: pointer; }
.auth-alt2 { color: #6b7280; }
.auth-card .fg small, .fg small { display: block; color: #9ca3af; margin-top: 4px; font-size: 12px; }

/* Campo de contraseña: ver/ocultar + medidor de seguridad (registro y restablecer) */
.fg--pw .pw-field { position: relative; }
.fg--pw .pw-field input { width: 100%; padding-right: 46px; }
.pw-eye { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; padding: 6px; border-radius: 8px; opacity: .55; }
.pw-eye:hover, .pw-eye--on { opacity: 1; background: #f3f4f6; }
/* Las barras no pueden encogerse: como el texto es largo (avisos), se aplastaban a 0 px y parecía
   que solo salían cuando la contraseña era fuerte. Ahora la barra tiene un mínimo, y el aviso pasa
   a su propia línea debajo, mida lo que mida. */
.pw-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.pw-meter i { display: block; height: 4px; flex: 1 1 40px; min-width: 26px; border-radius: 99px; background: #e5e7eb; transition: background .15s; }
.pw-meter[data-nivel="0"] i.on { background: #ef4444; }
.pw-meter[data-nivel="1"] i.on { background: #f59e0b; }
.pw-meter[data-nivel="2"] i.on { background: #16a34a; }
.pw-meter__txt { flex: 1 1 100%; font-size: 12px; font-weight: 600; color: #6b7280; white-space: normal; }
.pw-meter[data-nivel="0"] .pw-meter__txt { color: #ef4444; }
.pw-meter[data-nivel="2"] .pw-meter__txt { color: #16a34a; }
.auth-msg { margin-top: 14px; font-size: 13px; padding: 10px 12px; border-radius: 9px; display: none; }
.auth-msg--ok { background: var(--green-tint); color: var(--green-dark); display: block; }
.auth-msg--err { background: #fef2f2; color: var(--danger); display: block; }
.legal-small { font-size: 12px; color: #9ca3af; margin-top: 10px; line-height: 1.5; }

/* ── Cabecera del panel ── */
.dash-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-head h1 { font-size: 24px; font-weight: 800; color: var(--dark); }
.dash-head .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; color: #4b5563; font-size: 14px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; background: var(--green-tint); color: var(--green-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.verify-banner {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px;
  padding: 12px 16px; font-size: 13.5px; margin-bottom: 20px;
}

/* ── Tabs del panel ── */
.dash-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line-2); margin-bottom: 22px; flex-wrap: wrap; }
.dash-tabs button {
  border: 0; background: transparent; padding: 11px 16px; font-size: 14.5px; font-weight: 700;
  color: #6b7280; cursor: pointer; font-family: inherit; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.dash-tabs button:hover { color: var(--dark); }
.dash-tabs button.is-active { color: var(--green-dark); border-bottom-color: var(--green); }
.dash-tabs .count { font-size: 12px; background: #eef1f6; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }

/* ── Pedidos ── */
.order-list { display: flex; flex-direction: column; gap: 14px; }
.order-card { background: #fff; border: 1px solid var(--line-2); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.order-card__top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.order-card__id { font-weight: 800; color: var(--dark); font-size: 15px; }
.order-card__date { color: #6b7280; font-size: 13px; }
.order-card__total { margin-left: auto; font-weight: 800; color: var(--dark); font-size: 16px; }
.order-card__items { margin-top: 12px; color: #4b5563; font-size: 13.5px; line-height: 1.6; }
.order-card__actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.ship-box { margin-top: 12px; background: var(--green-tint); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.ship-box a { color: var(--green-dark); font-weight: 700; }
/* Aviso bajo los botones del pedido (p. ej. cuándo se habilita la factura) */
.order-note { color: #6b7280; font-size: 12.5px; margin-top: 8px; }

/* Estado vacío (sin pedidos todavía): se ve como una tarjeta con aire, no como un hueco. */
.empty-state {
  background: #fff; border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-sm);
  text-align: center; color: #6b7280; padding: 56px 24px; font-size: 14.5px; line-height: 1.6;
}
.verify-banner__btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.verify-banner__btn:disabled { opacity: .6; cursor: default; }
.empty-state .btn { margin-top: 14px; }

/* ── Direcciones ── */
.addr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.addr-card { background: #fff; border: 1px solid var(--line-2); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; }
.addr-card.is-default { border-color: var(--green); box-shadow: var(--ring); }
.addr-card h4 { font-size: 14px; color: var(--dark); margin-bottom: 6px; }
.addr-card p { font-size: 13.5px; color: #4b5563; line-height: 1.55; }
.addr-card .default-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--green-dark); background: var(--green-tint); border-radius: 999px; padding: 2px 9px; margin-bottom: 8px; }
.addr-card .addr-actions { margin-top: 12px; display: flex; gap: 8px; }
.addr-card .addr-actions .btn { padding: 6px 11px; font-size: 12.5px; }
.bill-same { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: #4b5563; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; cursor: pointer; }
.bill-same input { width: 16px; height: 16px; accent-color: var(--green); }

.section-head { display: flex; align-items: center; margin-bottom: 18px; gap: 12px; }
.section-head h2 { font-size: 18px; font-weight: 800; color: var(--dark); }
.section-head .spacer { flex: 1; }
.section-hint { color: #6b7280; font-size: 13px; margin: -8px 0 16px; }

/* ── Perfil ── */
/* Sin tope de ancho: «Datos personales», «Privacidad de datos» y «Darse de baja» deben medir lo
   mismo que la tarjeta «Direcciones de envío» (que ocupa el ancho completo del panel). */
.profile-form .form-grid { gap: 14px; }
.danger-zone { margin-top: 30px; border: 1px solid #fecaca; background: #fff5f5; border-radius: 14px; padding: 20px; }
.danger-zone h3 { color: var(--danger); font-size: 15px; margin-bottom: 6px; }
.danger-zone p { font-size: 13px; color: #7f1d1d; margin-bottom: 14px; line-height: 1.5; }

.hidden { display: none !important; }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 999;
  max-width: 90vw;
}
.toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--danger); }
.toast--success { background: var(--green-dark); }

@media (max-width: 640px) {
  .cuenta-main { padding: 90px 14px 48px; }
  .dash-head { gap: 12px; margin-bottom: 18px; }
  .dash-head h1 { font-size: 19px; }
  .who { font-size: 13px; overflow-wrap: anywhere; }
  .avatar { width: 38px; height: 38px; font-size: 15px; }
  .auth-wrap { margin-top: 6px; }
  .auth-card { padding: 22px 16px; border-radius: 16px; }
  .auth-card h2 { font-size: 18px; }
  .auth-tabs button { padding: 9px 8px; font-size: 13.5px; }
  .panel-card { padding: 18px 16px; }
  .dash-tabs { gap: 0; }
  .dash-tabs button { padding: 10px 12px; font-size: 14px; }
  .order-card { padding: 16px; }
  .order-card__top { gap: 8px; }
  .order-card__total { margin-left: 0; width: 100%; font-size: 15px; }
  .order-card__actions { flex-direction: column; }
  .order-card__actions .btn { width: 100%; text-align: center; justify-content: center; }
  .addr-grid { grid-template-columns: 1fr; }
  .section-head { flex-wrap: wrap; }
  .addr-card .addr-actions { flex-wrap: wrap; }
  .danger-zone { padding: 16px; }
  .toast { bottom: 16px; }
}

/* El checkout de la cuenta reutiliza los estilos de la tienda
   (modal-overlay/modal/co-*): no hay CSS propio del botón. */

/* ── Seguridad: 2FA, contraseña y sesiones ─────────────────── */
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #b91c1c; }

.sec-grid { display: grid; gap: 18px; max-width: 100%; }
.sec-title { font-size: 16px; font-weight: 800; color: var(--dark); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-badge { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; background: #f1f3f5; color: #6b7280; border: 1px solid var(--line-2); }
.sec-badge--on { background: var(--green-tint); color: var(--green-dark); border-color: rgba(118, 185, 0, .4); }
.sec-sub { font-size: 13.5px; color: #4b5563; margin-bottom: 12px; line-height: 1.55; }
.sec-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sec-ok { font-size: 13.5px; font-weight: 700; color: var(--green-dark); background: var(--green-tint); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.sec-qr { width: max-content; padding: 12px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; margin-bottom: 12px; }
.sec-qr svg { display: block; width: 180px; height: 180px; }
.sec-note { font-size: 12.5px; color: #6b7280; }
.sec-manual { margin-bottom: 12px; font-size: 13.5px; }
.sec-manual summary { cursor: pointer; color: var(--green-dark); font-weight: 600; }
.sec-manual p { margin: 10px 0 6px; }
.sec-secret { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-secret code { font-size: 13px; letter-spacing: .08em; background: #f4f6f8; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; overflow-wrap: anywhere; }
.sec-inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.sec-inline input { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: 15px; font-family: inherit; letter-spacing: .12em; min-width: 150px; }
.sec-inline input:focus { outline: none; border-color: var(--green); box-shadow: var(--ring); }
.sec-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 0 0 14px; padding: 0; }
.sec-codes li code { display: block; text-align: center; font-size: 14px; letter-spacing: .1em; background: #fff; border: 1px dashed var(--line-2); border-radius: 8px; padding: 8px 6px; }
.tab-dot { color: var(--green); font-size: 10px; vertical-align: middle; }
@media (max-width: 620px) { .sec-codes { grid-template-columns: 1fr; } }
