/* =================================================================
   MM Conversion Stack — Engagement (Sprint 4)
   Sticky bar + Popup
   ================================================================= */

/* ---------- Sticky bar ---------- */
.mmcs-stickybar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999998;
    padding: 10px 56px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, opacity 0.25s ease;
    text-align: center;
}
.mmcs-stickybar--top {
    top: 0;
}
.mmcs-stickybar--bottom {
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.1);
}
.mmcs-stickybar.is-closing {
    opacity: 0;
    transform: translateY(-100%);
}
.mmcs-stickybar--bottom.is-closing {
    transform: translateY(100%);
}

.mmcs-stickybar__inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    text-align: center;
}

.mmcs-stickybar__text {
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: center;
    width: 100%;
}
.mmcs-stickybar__text a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.mmcs-stickybar__text strong {
    font-weight: 700;
}

.mmcs-stickybar__countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 3px 12px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.mmcs-stickybar__close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    font-family: inherit;
}
.mmcs-stickybar__close:hover {
    opacity: 1;
}

@media (max-width: 600px) {
    .mmcs-stickybar { padding: 8px 40px; }
    .mmcs-stickybar__inner { gap: 8px; }
    .mmcs-stickybar__text { font-size: 0.7rem; letter-spacing: 0.04em; }
    .mmcs-stickybar__countdown { font-size: 0.78rem; padding: 2px 8px; }
    .mmcs-stickybar__close { right: 8px; font-size: 1.3rem; padding: 2px 6px; }
}

/* =================================================================
   PUSH-DOWN: el sticky bar empuja el header hacia abajo (no lo tapa).
   Se aplica cuando el JS detectó el bar y agregó la clase a body.
   La altura se mide en JS y se expone como --mmcs-sb-top-h.
   ================================================================= */

/* Header fijo: desplazado hacia abajo por la altura del bar */
body.mmcs-has-stickybar-top .mp-header {
    top: var(--mmcs-sb-top-h, 0px) !important;
}

/* Body padding-top: bar height + header height (con !important para vencer
   la regla `body.has-mp-header { padding-top: 80px !important }` del header) */
body.mmcs-has-stickybar-top.has-mp-header {
    padding-top: calc(var(--mmcs-sb-top-h, 0px) + 80px) !important;
}
body.mmcs-has-stickybar-top.home.has-mp-header {
    padding-top: calc(var(--mmcs-sb-top-h, 0px) + 40px) !important;
}
@media (max-width: 849px) {
    body.mmcs-has-stickybar-top.has-mp-header {
        padding-top: calc(var(--mmcs-sb-top-h, 0px) + 64px) !important;
    }
    body.mmcs-has-stickybar-top.home.has-mp-header {
        padding-top: calc(var(--mmcs-sb-top-h, 0px) + 40px) !important;
    }
}

/* Mismo offset para drawers (mega menu, side cart, side search) que son
   fixed top:0 — si no, quedan tapados por el sticky bar */
body.mmcs-has-stickybar-top .mp-mega,
body.mmcs-has-stickybar-top .mp-side-search,
body.mmcs-has-stickybar-top .mp-side-cart {
    top: var(--mmcs-sb-top-h, 0px) !important;
}

/* Bottom sticky bar: padding-bottom para no tapar contenido + footer cosas */
body.mmcs-has-stickybar-bottom {
    padding-bottom: var(--mmcs-sb-bottom-h, 0px);
}

/* ---------- Popup ---------- */
.mmcs-popup[hidden] {
    display: none;
}

.mmcs-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mmcs-popup.is-open {
    opacity: 1;
}

.mmcs-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.mmcs-popup__dialog {
    position: relative;
    background: #fff;
    border-radius: 6px;
    padding: 48px 36px 36px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}
.mmcs-popup.is-open .mmcs-popup__dialog {
    transform: scale(1) translateY(0);
}

.mmcs-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 6px 12px;
    transition: color 0.2s ease;
    font-family: inherit;
}
.mmcs-popup__close:hover {
    color: #000;
}

.mmcs-popup__title {
    margin: 0 0 14px;
    font-size: 1.7rem;
    line-height: 1.2;
    color: #000;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.mmcs-popup__message {
    margin: 0 0 24px;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.55;
}
.mmcs-popup__message p {
    margin: 0 0 10px;
}
.mmcs-popup__message p:last-child {
    margin: 0;
}
.mmcs-popup__message a {
    color: #000;
    text-decoration: underline;
}

.mmcs-popup__cta {
    display: inline-block;
    background: #000;
    color: #fff;
    text-decoration: none;
    padding: 14px 36px;
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 3px;
    transition: background 0.2s ease, transform 0.15s ease;
}
.mmcs-popup__cta:hover {
    background: #333;
    color: #fff;
    transform: translateY(-1px);
}
.mmcs-popup__cta:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    .mmcs-popup__dialog { padding: 40px 24px 28px; }
    .mmcs-popup__title { font-size: 1.4rem; }
    .mmcs-popup__message { font-size: 0.88rem; }
    .mmcs-popup__cta { padding: 12px 24px; font-size: 0.78rem; }
}
