/* MyLive.fit App — mismo sistema visual que el tema WordPress "mylivefit" */

/* ---------- Fuentes alojadas en el servidor ---------- */
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/poppins-700.woff2") format("woff2"); }

/* ---------- Tokens del tema ---------- */
:root {
  --noche: #0F172A;
  --noche-2: #1E293B;
  --naranja: #EA580C;
  --naranja-claro: #F97316;
  --naranja-texto: #C2410C;
  --naranja-suave: #FFEDD5;
  --superficie: #FFFFFF;
  --superficie-alt: #F8FAFC;
  --tinta: #0F172A;
  --tinta-suave: #475569;
  --tinta-clara: #CBD5E1;
  --borde: #E2E8F0;
  --exito: #15803D;
  --error: #B91C1C;
  --radio-sm: 8px;
  --radio-md: 16px;
  --radio-pill: 999px;
  --fuente: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --tabbar-h: 64px;

  /* Bootstrap mapeado a los tokens */
  --bs-body-font-family: var(--fuente);
  --bs-body-color: var(--tinta);
  --bs-body-bg: var(--superficie-alt);
  --bs-secondary-color: var(--tinta-suave);
  --bs-border-color: var(--borde);
  --bs-border-radius: var(--radio-sm);
  --bs-border-radius-lg: var(--radio-md);
  --bs-primary: var(--naranja);
  --bs-primary-rgb: 234, 88, 12;
  --bs-primary-text-emphasis: var(--naranja-texto);
  --bs-primary-bg-subtle: var(--naranja-suave);
  --bs-link-color: var(--naranja-texto);
  --bs-link-color-rgb: 194, 65, 12;
  --bs-link-hover-color: var(--naranja);
  --bs-link-hover-color-rgb: 234, 88, 12;
  --bs-success: var(--exito);
  --bs-danger: var(--error);
  --bs-heading-color: var(--tinta);
  --bs-focus-ring-color: rgba(234, 88, 12, .3);
}

body { font-family: var(--fuente); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, .h1, .h2, .h3 { font-weight: 700; letter-spacing: -.01em; }
h4, h5, h6, .h4, .h5, .h6 { font-weight: 600; }
.skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 2000; background: var(--superficie); padding: .5rem 1rem; border-radius: var(--radio-sm); }

/* ---------- Botones (píldora como en el sitio) ---------- */
.btn { border-radius: var(--radio-pill); font-weight: 600; padding-inline: 1.25rem; }
.btn-sm { padding-inline: .9rem; }
.btn-link { border-radius: var(--radio-sm); }
.btn-primary {
  --bs-btn-bg: var(--naranja); --bs-btn-border-color: var(--naranja);
  --bs-btn-hover-bg: var(--naranja-texto); --bs-btn-hover-border-color: var(--naranja-texto);
  --bs-btn-active-bg: #9A3412; --bs-btn-active-border-color: #9A3412;
  --bs-btn-disabled-bg: var(--naranja); --bs-btn-disabled-border-color: var(--naranja);
  --bs-btn-focus-shadow-rgb: 234, 88, 12;
}
.btn-outline-primary {
  --bs-btn-color: var(--naranja-texto); --bs-btn-border-color: var(--naranja);
  --bs-btn-hover-bg: var(--naranja); --bs-btn-hover-border-color: var(--naranja); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--naranja-texto); --bs-btn-active-border-color: var(--naranja-texto);
  --bs-btn-focus-shadow-rgb: 234, 88, 12;
}
.btn[aria-busy="true"] { pointer-events: none; opacity: .7; }
.text-primary { color: var(--naranja) !important; }
.bg-primary { background-color: var(--naranja) !important; }
.text-bg-soft { background: var(--naranja-suave); color: var(--naranja-texto); font-weight: 600; }
.form-control, .form-select { border-color: var(--borde); }
.form-control:focus, .form-select:focus { border-color: var(--naranja-claro); box-shadow: 0 0 0 .2rem rgba(234, 88, 12, .2); }
.form-check-input:checked { background-color: var(--naranja); border-color: var(--naranja); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--noche); --bs-nav-pills-border-radius: var(--radio-pill); --bs-nav-link-color: var(--tinta-suave); --bs-nav-link-hover-color: var(--tinta); }

/* ---------- Tarjetas ---------- */
.card { --bs-card-border-color: var(--borde); --bs-card-border-radius: var(--radio-md); --bs-card-inner-border-radius: calc(var(--radio-md) - 1px); box-shadow: var(--sombra); }

/* ---------- Cabecera y navegación ---------- */
.app-header { background: var(--noche); position: sticky; top: 0; z-index: 1030; padding-top: env(safe-area-inset-top); }
.app-header .navbar { min-height: 64px; }
.app-header .nav-link { color: var(--tinta-clara); font-weight: 600; border-radius: var(--radio-pill); padding: .45rem .9rem !important; display: flex; align-items: center; gap: .4rem; }
.app-header .nav-link:hover { color: #fff; }
.app-header .nav-link.active { color: #fff; background: rgba(255, 255, 255, .08); }
.app-header .nav-link.active .ico { color: var(--naranja-claro); }
.ico { width: 20px; height: 20px; flex: none; }
.ico-lg { width: 32px; height: 32px; }

.app-main { padding-top: 1.5rem; padding-bottom: calc(var(--tabbar-h) + 2rem + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { .app-main { padding-bottom: 3rem; } }

/* Barra inferior estilo app en móvil */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 1030; display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--superficie); border-top: 1px solid var(--borde); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06);
}
.tabbar .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; font-weight: 600; color: var(--tinta-suave); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tabbar .tab.active { color: var(--naranja); }
.tabbar .ico { width: 24px; height: 24px; }

/* Contador de avisos sin leer sobre el icono de la campana */
.tab-icon { position: relative; display: inline-flex; }
.count-badge {
  position: absolute; top: -6px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radio-pill); background: var(--naranja); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--superficie);
}
.app-header .count-badge { box-shadow: 0 0 0 2px var(--noche); }
.count-badge[hidden] { display: none; }

/* ---------- Avatares ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: inline-flex; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-initial { align-items: center; justify-content: center; background: var(--naranja); color: #fff; font-weight: 700; }
.avatar-initial.avatar-72 { font-size: 1.75rem; }

/* ---------- Acceso ---------- */
.layout-auth { background: var(--noche) url("../img/hero.svg") no-repeat right -120px bottom -80px / 520px auto; min-height: 100vh; }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 440px; border: 0; }
.auth-card .card-body { padding: 2rem 1.5rem; }
@media (min-width: 576px) { .auth-card .card-body { padding: 2.5rem; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Inicio ---------- */
.hero-card { background: var(--noche); color: #fff; border-radius: var(--radio-md); padding: 1.5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; overflow: hidden; box-shadow: var(--sombra); }
.hero-card h1 { color: #fff; }
.hero-img { width: 180px; height: auto; margin: -1rem -1rem -1.5rem 0; }
.eyebrow { color: var(--naranja-claro); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.pillar { overflow: hidden; transition: transform .15s ease; }
.pillar .card-img-top { aspect-ratio: 400 / 260; height: auto; object-fit: cover; }
.notif-list li { padding: .5rem 0 .5rem .9rem; border-left: 3px solid var(--borde); margin-bottom: .5rem; }
.notif-list li.unread { border-left-color: var(--naranja); }
.activity-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--borde); font-size: .9rem; }
.activity-list li:last-child { border-bottom: 0; }

.upcoming li { display: flex; gap: .75rem; align-items: baseline; padding: .4rem 0; border-bottom: 1px solid var(--borde); }
.upcoming li:last-child { border-bottom: 0; }
.upcoming strong { font-variant-numeric: tabular-nums; color: var(--naranja-texto); min-width: 3rem; }
.upcoming span { flex: 1; }

/* ---------- Avisos ---------- */
.notif-item .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: .45rem; background: transparent; flex: none; }
.notif-item.unread { background: #FFF7ED; }
.notif-item.unread .dot { background: var(--naranja); }
.min-w-0 { min-width: 0; }

/* ---------- Recordatorios ---------- */
.days-picker { display: grid; grid-template-columns: repeat(7, minmax(0, 2.6rem)); gap: .3rem; }
.days-picker .btn { width: 100%; padding-inline: 0; }
.rem-icon { font-size: 1.4rem; width: 2.25rem; text-align: center; flex: none; }
.rem-time { font-variant-numeric: tabular-nums; }
.reminder-item.is-off { opacity: .55; }
.preset-btn { border-radius: var(--radio-md); padding: .8rem 1.1rem; }
.form-switch { padding-left: 3.3em; min-height: 1.6em; }
.form-switch .form-check-input { width: 2.6em; height: 1.4em; margin-left: -3.3em; margin-top: .05em; cursor: pointer; }
.form-switch .form-check-label { padding-top: .1em; }

/* Hoja inferior para pedir permiso de notificaciones */
.push-sheet { position: fixed; inset: auto 0 0 0; z-index: 1060; padding: 1rem 1rem calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); background: transparent; animation: up .2s ease-out; }
.push-sheet .card { max-width: 480px; margin: 0 auto; border: 0; background: var(--superficie); content-visibility: visible; box-shadow: 0 10px 40px rgba(15, 23, 42, .25); }
.flex-none { flex: none; }
@media (min-width: 768px) { .push-sheet { padding-bottom: 1.5rem; } }
@keyframes up { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Guía de instalación */
.install-steps { counter-reset: paso; list-style: none; padding: 0; margin: 0; }
.install-steps li { counter-increment: paso; display: flex; gap: .9rem; align-items: flex-start; padding: .8rem 0; border-bottom: 1px solid var(--borde); }
.install-steps li:last-child { border-bottom: 0; }
.install-steps li::before { content: counter(paso); flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--naranja); color: #fff; font-weight: 700; display: grid; place-items: center; }
.install-steps .ico { vertical-align: -4px; color: #0A84FF; }
.platform[hidden] { display: none !important; }

/* ---------- Perfil ---------- */
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; }
.meta-list dt { font-weight: 600; color: var(--tinta-suave); }
.meta-list dd { margin: 0; }

/* ---------- Administración ---------- */
.admin-tabs .nav-link { white-space: nowrap; font-weight: 600; }
.kpi .card-body { display: flex; flex-direction: column; gap: .25rem; }
.kpi-label { font-size: .8rem; color: var(--tinta-suave); font-weight: 600; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; min-height: 2.1rem; font-variant-numeric: tabular-nums; }
.chart { height: 220px; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart .bar-views { fill: var(--naranja); }
.chart .bar-users { fill: var(--noche); }
.chart text { font-size: 10px; fill: var(--tinta-suave); font-family: var(--fuente); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.sw-views { background: var(--naranja); }
.sw-users { background: var(--noche); }
.top-pages li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--borde); font-size: .9rem; }
.top-pages li:last-child { border-bottom: 0; }
.audit-table code { color: var(--naranja-texto); font-size: .8rem; }
.mw-12 { max-width: 12rem; }
.mw-16 { max-width: 16rem; }
.push-preview { display: flex; gap: .75rem; padding: .9rem; border-radius: var(--radio-md); background: var(--superficie-alt); border: 1px solid var(--borde); }
.push-preview img { border-radius: 10px; }
.push-preview strong, .push-preview span { display: block; overflow-wrap: anywhere; }
.push-preview span { font-size: .875rem; color: var(--tinta-suave); }

/* ---------- Esqueletos de carga ---------- */
.skeleton { display: inline-block; background: linear-gradient(90deg, #E2E8F0 0%, #F1F5F9 50%, #E2E8F0 100%); background-size: 200% 100%; border-radius: 6px; animation: sk 1.2s ease-in-out infinite; }
.skeleton-text { height: .9rem; }
.skeleton-num { width: 3.5rem; height: 1.6rem; }
.skeleton-block { display: block; width: 100%; height: 100%; }
.skeleton-row { display: flex; flex-direction: column; gap: .4rem; }
.activity-list .skeleton-row, .top-pages .skeleton-row { flex-direction: row; justify-content: space-between; }
.w-25 { width: 25%; } .w-60 { width: 60%; } .w-80 { width: 80%; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Varios ---------- */
.offline-banner { position: fixed; top: 0; inset-inline: 0; z-index: 2000; background: var(--error); color: #fff; text-align: center; font-size: .875rem; padding: .35rem 1rem calc(.35rem); padding-top: calc(.35rem + env(safe-area-inset-top)); }
.toast { border-radius: var(--radio-md); }
.toast-container { padding-bottom: calc(var(--tabbar-h) + 1rem) !important; }
@media (min-width: 768px) { .toast-container { padding-bottom: 1rem !important; } }

/* Evita trabajo de render en lo que está fuera de pantalla */
.card, .hero-card { content-visibility: auto; contain-intrinsic-size: auto 200px; }
.auth-card { content-visibility: visible; }

@media (hover: hover) { .pillar:hover { transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Pie de página con los créditos */
.site-footer { margin-top: 2.5rem; padding: 1.25rem 0 .25rem; border-top: 1px solid var(--borde); text-align: center; font-size: .8rem; color: var(--tinta-suave); line-height: 1.7; }
.site-footer a { color: var(--naranja-texto); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.auth-main .site-footer, .bare-main .site-footer { grid-column: 1 / -1; width: 100%; max-width: 520px; margin: 1.5rem auto 0; }
.auth-main { grid-template-rows: 1fr auto; }
.auth-main .site-footer { border: 0; color: #E2E8F0; align-self: end; background: rgba(15, 23, 42, .88); border-radius: var(--radio-md); padding: .8rem 1rem; }
.auth-main .site-footer a { color: var(--naranja-claro); }

/* Estado del cron (Admin) */
.cron-card { border-left: 4px solid #16A34A; }
.cron-card.is-bad { border-left-color: var(--error, #DC2626); }
.cron-cmd { display: inline-block; margin-top: .25rem; padding: .35rem .5rem; background: var(--superficie-alt); border-radius: 6px; word-break: break-all; user-select: all; }
