/* =============================================================
   HEADER "EDICIÓN CLÍNICA" — Fase 2 del rediseño
   Referencia vinculante: design_handoff_esther_gaya (frames 2a/2b).
   Se carga DESPUÉS de header-premium.css y edicion-clinica.css:
   sobrescribe el header legacy sin tocar sus ficheros (las reglas
   antiguas siguen existiendo pero ya no matchean el markup nuevo,
   salvo .navbar, que se re-tematiza aquí con .navbar.ec-header).

   Alturas (fuente de la verdad del offset del body):
   - móvil (≤768px):   60px  (--header-height-mobile)
   - tablet (769–992): 78px  (fila principal, sin topbar)
   - desktop (≥993px): 108px (topbar 30px + fila 78px)
   ============================================================= */

:root {
    --ec-header-row: 78px;
    --ec-header-row-compact: 60px;
    --ec-topbar-h: 30px;
    --header-height: var(--ec-header-row);
    --header-height-mobile: 60px;
}

@media (min-width: 993px) {
    :root {
        --header-height: calc(var(--ec-header-row) + var(--ec-topbar-h));
    }
}

/* ---------- Barra base ---------- */
.navbar.ec-header {
    height: auto;
    padding: 0; /* main.css/layout.css añaden padding vertical a .navbar; aquí la altura la dan topbar+fila */
    background: rgba(247, 243, 241, 0.94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--ec-border);
    font-family: var(--ec-font-body);
    color: var(--ec-ink);
}

.navbar.ec-header.nav-scrolled {
    height: auto;
    background: rgba(247, 243, 241, 0.97);
    box-shadow: 0 4px 20px rgba(46, 36, 41, 0.05);
}

.navbar.ec-header.nav-hidden {
    height: auto;
    background: rgba(247, 243, 241, 0.98);
}

/* ---------- Topbar (solo desktop) ---------- */
.ec-topbar {
    display: none;
}

@media (min-width: 993px) {
    .ec-topbar {
        display: block;
        border-bottom: 1px solid rgba(46, 36, 41, 0.08);
        overflow: hidden;
        max-height: var(--ec-topbar-h);
        transition: max-height var(--ec-transition);
    }

    .ec-topbar-inner {
        max-width: 1440px;
        margin: 0 auto;
        height: var(--ec-topbar-h);
        padding: 0 2rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 11px;
        color: var(--ec-muted);
    }

    .ec-topbar-links {
        display: flex;
        gap: 18px;
    }

    .ec-topbar-links a {
        text-decoration: none;
        color: var(--ec-muted);
        transition: color var(--ec-transition);
    }

    .ec-topbar-links a:hover {
        color: var(--ec-ink);
    }

    .ec-topbar-links a.ec-topbar-quiz {
        color: var(--ec-mauve);
        font-weight: 600;
    }

    /* Al compactar (scroll), el topbar se pliega */
    .navbar.ec-header.nav-scrolled .ec-topbar,
    .navbar.ec-header.nav-hidden .ec-topbar {
        max-height: 0;
        border-bottom-color: transparent;
    }
}

/* ---------- Fila principal ---------- */
.ec-nav-row {
    max-width: 1440px;
    margin: 0 auto;
    height: var(--ec-header-row);
    padding: 0 2rem;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    transition: height var(--ec-transition);
}

.navbar.ec-header.nav-hidden .ec-nav-row {
    height: var(--ec-header-row-compact);
}

@media (max-width: 768px) {
    .ec-nav-row {
        height: var(--header-height-mobile);
        padding: 0 20px;
    }

    .navbar.ec-header.nav-hidden .ec-nav-row {
        height: var(--header-height-mobile);
    }
}

/* ---------- Logo ---------- */
.ec-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ec-ink);
    flex-shrink: 0;
}

.ec-logo-mark {
    width: 34px;
    height: 34px;
    border: 1px solid var(--ec-rose);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--ec-font-display);
    font-size: 15px;
    color: var(--ec-rose);
    flex-shrink: 0;
}

.ec-logo-text {
    display: flex;
    flex-direction: column;
}

.ec-logo-name {
    font-family: var(--ec-font-display);
    font-weight: 400;
    font-size: 19px;
    line-height: 1;
    color: var(--ec-ink);
}

.ec-logo-tag {
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ec-muted);
    margin-top: 3px;
}

@media (max-width: 768px) {
    .ec-logo-mark {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        font-size: 13px;
    }

    .ec-logo-name {
        font-size: 17px;
    }

    .ec-logo-tag {
        display: none;
    }
}

/* ---------- Navegación desktop (5 grupos actuales) ---------- */
.ec-nav {
    display: flex;
    align-items: stretch;
    gap: 2px;
    transition: opacity var(--ec-transition);
}

@media (max-width: 992px) {
    .ec-nav {
        display: none;
    }
}

.navbar.ec-header.nav-hidden .ec-nav {
    opacity: 0;
    pointer-events: none;
}

.ec-nav-group {
    display: flex;
    align-items: stretch;
    /* static a propósito: los paneles se posicionan respecto a .navbar */
    position: static;
}

.ec-nav-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 13px;
    font-family: var(--ec-font-body);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ec-text-2);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--ec-transition);
    white-space: nowrap;
}

.ec-nav-group:hover .ec-nav-toggle,
.ec-nav-group:focus-within .ec-nav-toggle,
a.ec-nav-toggle:hover {
    color: var(--ec-ink);
}

.ec-caret {
    font-size: 9px;
    color: var(--ec-muted);
    transform: translateY(1px);
}

/* ---------- Paneles (mega-dropdown, ancho completo) ---------- */
.ec-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border-bottom: 1px solid var(--ec-border-12);
    box-shadow: 0 24px 40px -20px rgba(46, 36, 41, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--ec-transition), transform var(--ec-transition), visibility var(--ec-transition);
    z-index: 1001;
}

.ec-nav-group:hover .ec-panel,
.ec-nav-group:focus-within .ec-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ec-panel-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 26px 36px 28px;
}

/* Panel Servicios: 3 tarjetas + columna lateral */
.ec-panel-svc {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 0.9fr;
    gap: 18px;
}

.ec-svc-card {
    border: 1px solid var(--ec-border-12);
    border-radius: var(--ec-radius-card-sm);
    padding: 16px;
    text-decoration: none;
    color: var(--ec-ink);
    transition: border-color var(--ec-transition), box-shadow var(--ec-transition);
}

.ec-svc-card:hover {
    border-color: rgba(184, 114, 142, 0.5);
    box-shadow: var(--ec-shadow-featured);
}

.ec-svc-card.ec-svc-featured {
    border-color: rgba(184, 114, 142, 0.5);
    background: #FDF8FA;
}

.ec-svc-kicker {
    font-size: 11px;
    color: var(--ec-muted);
}

.ec-svc-featured .ec-svc-kicker {
    color: var(--ec-mauve);
    font-weight: 700;
}

.ec-svc-name {
    font-family: var(--ec-font-display);
    font-weight: 400;
    font-size: 18px;
    margin: 3px 0 6px;
}

.ec-svc-price {
    font-size: 13px;
    color: var(--ec-rose);
    font-weight: 700;
}

.ec-panel-side {
    border-left: 1px solid var(--ec-border);
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    font-size: 13px;
    justify-content: center;
}

.ec-panel a.ec-plink {
    text-decoration: none;
    color: var(--ec-text-2);
    transition: color var(--ec-transition);
}

.ec-panel a.ec-plink:hover {
    color: var(--ec-rose);
}

.ec-panel a.ec-plink-more {
    color: var(--ec-mauve);
    font-weight: 600;
}

/* Panel Rutinas: objetivos + recursos */
.ec-panel-rut {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
}

.ec-panel-label {
    font-family: var(--ec-font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ec-mauve);
    margin-bottom: 12px;
}

.ec-panel-grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    font-size: 13.5px;
}

.ec-panel-grid2 a.ec-plink {
    padding: 4px 0;
}

.ec-panel-col {
    border-left: 1px solid var(--ec-border);
    padding-left: 24px;
}

.ec-panel-col .ec-panel-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    font-size: 13.5px;
}

/* Paneles simples (Aprende +, Sobre Mí, Catálogo): fila de enlaces */
.ec-panel-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 40px;
    font-size: 13.5px;
}

/* ---------- Utilidades (Catálogo + CTA + burger) ---------- */
.ec-nav-utils {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.ec-nav-utils .ec-nav-group {
    align-self: stretch;
}

.ec-catalog-link {
    display: flex;
    align-items: center;
    align-self: center;
    padding: 9px 18px;
    border: 1px solid rgba(184, 114, 142, 0.4);
    border-radius: var(--ec-radius-pill);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ec-mauve);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--ec-transition), color var(--ec-transition);
}

.ec-catalog-link:hover {
    background: rgba(184, 114, 142, 0.08);
}

@media (max-width: 768px) {
    .ec-catalog-link {
        display: none;
    }
}

/* Acceso clientas: icono de usuario -> portal /cliente (login por enlace magico).
   Restaurado 2026-07-08: se perdio en el rediseno F2 y la clienta no tenia acceso
   visible en la barra. Icono siempre visible; el texto "Mi rutina" solo en desktop. */
.ec-account {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: center;
    min-height: var(--ec-tap-min);
    padding: 0 4px;
    color: var(--ec-ink);
    text-decoration: none;
    font-family: var(--ec-font-body);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: color var(--ec-transition);
}

.ec-account:hover {
    color: var(--ec-mauve);
}

.ec-account-ic {
    flex-shrink: 0;
}

@media (max-width: 992px) {
    .ec-account-label {
        display: none;
    }
}

.ec-nav-cta {
    align-self: center;
    background: var(--ec-rose-cta); /* F8: 3.60:1 → 5.16:1 con blanco */
    color: #fff;
    border-radius: var(--ec-radius-pill);
    padding: 11px 22px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--ec-transition), transform var(--ec-transition);
}

.ec-nav-cta:hover {
    background: var(--ec-rose-cta-hover); /* F8 */
}

.ec-cta-mobile {
    display: none;
}

@media (max-width: 992px) {
    .ec-cta-desktop {
        display: none;
    }

    .ec-cta-mobile {
        display: inline;
    }
}

@media (max-width: 768px) {
    /* Móvil: el CTA pasa a enlace de texto rosa, como el prototipo 2a.
       F8: 11.5px/#B8728E (3.26:1) → 13px/--ec-rose-text (4.68:1 sobre bg)
       + zona táctil >=44px (antes ~26px). */
    .ec-nav-cta {
        background: none;
        display: inline-flex;
        align-items: center;
        min-height: var(--ec-tap-min);
        padding: 0;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--ec-rose-text);
    }

    .ec-nav-cta:hover {
        background: none;
    }
}

/* Burger: 3 líneas, la tercera más corta (prototipo 2a) */
.ec-burger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    /* F8: área táctil 44x44 (el dibujo de 3 líneas no cambia) */
    padding: 15px 12px;
    align-self: center;
    flex-direction: column;
    gap: 4.5px;
}

.ec-burger span {
    display: block;
    width: 20px;
    height: 1.6px;
    background: var(--ec-ink);
    transition: background var(--ec-transition);
}

.ec-burger span:nth-child(3) {
    width: 13px;
}

@media (max-width: 992px) {
    .ec-burger {
        display: flex;
    }
}

/* Aviso "pago seguro" en checkout (rama pagos del header) */
.ec-pay-note {
    display: flex;
    align-items: center;
    align-self: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--ec-muted);
}

/* =============================================================
   MENÚ MÓVIL — sheet a pantalla completa (prototipo 2a)
   ============================================================= */
.ec-msheet {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--ec-bg);
    color: var(--ec-ink);
    font-family: var(--ec-font-body);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ec-transition), visibility var(--ec-transition);
}

.ec-msheet.active {
    opacity: 1;
    visibility: visible;
}

.ec-msheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--ec-border);
}

.ec-msheet-title {
    font-family: var(--ec-font-display);
    font-size: 17px;
}

.ec-msheet-close {
    background: none;
    border: 1px solid rgba(46, 36, 41, 0.2);
    border-radius: var(--ec-radius-pill);
    width: 44px;  /* F8: 32px → 44px */
    height: 44px; /* F8: 32px → 44px */
    cursor: pointer;
    font-size: 17px; /* F8: 15px → 17px */
    line-height: 1;
    color: var(--ec-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid de accesos */
.ec-msheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px 20px 4px;
}

.ec-mtile {
    display: block;
    background: #fff;
    border: 1px solid var(--ec-border-16);
    color: var(--ec-ink);
    border-radius: var(--ec-radius-card-sm);
    padding: 14px 12px;
    text-decoration: none;
    position: relative;
    transition: transform var(--ec-transition);
}

.ec-mtile:active {
    transform: scale(0.98);
}

.ec-mtile-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.ec-mtile-sub {
    display: block;
    font-size: 12px; /* F8: 10.5px → 12px (llevan precio y contenido) */
    color: var(--ec-muted);
    margin-top: 3px;
}

.ec-mtile-primary {
    background: var(--ec-rose-cta); /* F8: 3.60:1 → 5.16:1 con blanco */
    border-color: var(--ec-rose-cta);
    color: #fff;
}

.ec-mtile-primary .ec-mtile-sub {
    color: #fff; /* F8: blanco 85% (3.06:1) → blanco puro (5.16:1) */
}

.ec-mtile-dashed {
    border: var(--ec-dashed-border);
    background: transparent;
}

.ec-mtile-live {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    background: var(--ec-dark);
    color: #fff;
    font-family: var(--ec-font-mono);
    font-size: 11px; /* F8: 8px → 11px (comunica estado LIVE) */
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: var(--ec-radius-pill);
}

.ec-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ec-rose-light);
    animation: ec-pulse-dot 1.4s ease-in-out infinite;
    display: inline-block;
}

@keyframes ec-pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.4);
    }
}

/* Acordeones <details> */
.ec-msheet-body {
    padding: 10px 20px 20px;
}

.ec-m-acc {
    border-bottom: 1px solid var(--ec-border);
    padding: 0; /* F8: el padding vertical pasa al summary (zona táctil) */
}

.ec-m-acc summary {
    font-size: 15px; /* F8: 14.5px → 15px */
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 0; /* F8: zona táctil ~49px (antes en el padre, no clicable) */
}

.ec-m-acc summary::-webkit-details-marker {
    display: none;
}

.ec-m-acc summary::after {
    content: '+';
    font-size: 16px;
    font-weight: 400;
    color: var(--ec-muted);
    transition: transform var(--ec-transition);
}

.ec-m-acc[open] summary::after {
    content: '–';
}

.ec-m-acc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 0; /* F8: los enlaces ya llevan padding táctil */
    padding-bottom: 6px;
}

.ec-m-acc-list a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px; /* F8: 13px → 14px */
    color: var(--ec-text-2);
    text-decoration: none;
    padding: 11px 0; /* F8: 7px → 11px (fila táctil ~44px) */
}

.ec-m-acc-list a .ec-mprice {
    color: var(--ec-rose-text); /* F8: 3.26:1 → 4.68:1 sobre bg (precios) */
    font-weight: 600;
}

.ec-m-acc-list a.ec-mlink-more {
    color: var(--ec-mauve);
    font-weight: 600;
}

/* Fila de enlaces sueltos (Sobre mí · Contacto) */
.ec-msheet-links {
    display: flex;
    gap: 16px;
    padding: 6px 0 4px;
}

.ec-msheet-links a {
    font-size: 14px; /* F8: 13px → 14px */
    color: var(--ec-text-2);
    text-decoration: none;
    display: inline-block;
    padding: 11px 0; /* F8: zona táctil ~44px */
}

/* Pie mono: horario + social */
.ec-msheet-foot {
    font-family: var(--ec-font-mono);
    font-size: 12px; /* F8: 9.5px → 12px (horario = información) */
    letter-spacing: var(--ec-ls-mono);
    color: var(--ec-muted);
    padding-top: 14px;
    border-top: 1px solid var(--ec-border);
    margin-top: 8px;
    line-height: 1.9;
}

.ec-msheet-foot a {
    color: var(--ec-muted);
    text-decoration: none;
    display: inline-block;
    padding: 11px 6px; /* F8: zona táctil ~45px en TikTok/IG/YouTube */
}

.ec-msheet-foot a:hover {
    color: var(--ec-ink);
}
