/**
 * NDC · Aviso inteligente de adhesivo
 *
 * Estética premium-minimalista de newdecoracion.com.
 * Hereda Global Colors y tipografía de Elementor mediante variables CSS,
 * con fallback a los valores del diseño para que se vea bien aunque no existan.
 * Todo va prefijado con .ndc-adhesivo para evitar colisiones con Elementor/ElementsKit.
 */

.ndc-adhesivo {
    /* Paleta del diseño (fija). Los Global Colors de la web no coinciden con
       los del diseño — su «accent» es oscuro, no el amarillo — así que usamos
       los valores exactos del diseño para garantizar el aspecto correcto. */
    --ndc-primary: #f5d000;
    --ndc-primary-hover: #e4c200;
    --ndc-ink: #26292b;
    --ndc-ink-strong: #26292b;
    --ndc-text: #71767b;
    --ndc-muted: #9aa0a5;
    --ndc-line: #e5e7e9;
    --ndc-fill: #f7f8f8;
    --ndc-card: #ffffff;

    --ndc-radius: 4px;
    --ndc-font-head: var( --e-global-typography-primary-font-family, "Poppins" ), system-ui, sans-serif;
    --ndc-font-body: var( --e-global-typography-text-font-family, "Mulish" ), system-ui, sans-serif;

    position: fixed;
    inset: 0;
    z-index: 999990;
    display: none;
    font-family: var( --ndc-font-body );
    color: var( --ndc-ink-strong );
}

/* Estados visibles del contenedor. */
.ndc-adhesivo[data-ndc-state="open"],
.ndc-adhesivo[data-ndc-state="added"] {
    display: block;
}

/* Cuando está descartado solo se ve el chip; el contenedor no captura clics. */
.ndc-adhesivo[data-ndc-state="chip"] {
    display: block;
    pointer-events: none;
}

.ndc-adhesivo *,
.ndc-adhesivo *::before,
.ndc-adhesivo *::after {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------- Backdrop */
.ndc-adhesivo__backdrop {
    position: absolute;
    inset: 0;
    background: rgba( 26, 41, 43, 0.55 );
    animation: ndc-adhesivo-fade 0.2s ease;
}

.ndc-adhesivo[data-ndc-state="chip"] .ndc-adhesivo__backdrop,
.ndc-adhesivo[data-ndc-state="chip"] .ndc-adhesivo__dialog {
    display: none;
}

/* ----------------------------------------------------------------- Diálogo */
.ndc-adhesivo__dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate( -50%, -50% );
    width: calc( 100% - 48px );
    max-width: 440px;
    max-height: calc( 100vh - 48px );
    overflow-y: auto;
    background: var( --ndc-card );
    box-shadow: 0 24px 70px rgba( 0, 0, 0, 0.32 );
    animation: ndc-adhesivo-pop 0.22s ease;
}

.ndc-adhesivo[data-ndc-state="added"] .ndc-adhesivo__dialog {
    max-width: 420px;
}

/* El "grip" del panel inferior solo se ve en móvil. */
.ndc-adhesivo__grip {
    display: none;
}

.ndc-adhesivo__view {
    padding: 26px 28px 28px;
}

/* -------------------------------------------------------------- Cabecera */
.ndc-adhesivo__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.ndc-adhesivo__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var( --ndc-ink-strong );
    color: var( --ndc-primary );
    font-family: var( --ndc-font-head );
    font-weight: 600;
    font-size: 10.5px;
    letter-spacing: 0.07em;
    padding: 5px 11px;
}

.ndc-adhesivo__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var( --ndc-primary );
}

.ndc-adhesivo__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: var( --ndc-muted );
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.ndc-adhesivo__close:hover,
.ndc-adhesivo__close:focus-visible {
    color: var( --ndc-ink-strong );
}

/* ----------------------------------------------------------------- Textos */
.ndc-adhesivo__title {
    font-family: var( --ndc-font-head );
    font-weight: 700;
    font-size: 23px;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
    color: var( --ndc-ink-strong );
}

.ndc-adhesivo__msg {
    margin: 0 0 18px;
    font-size: 14.5px;
    line-height: 1.5;
    color: var( --ndc-text );
}

/* ------------------------------------------------------------- Cálculo */
.ndc-adhesivo__calc {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    background: var( --ndc-fill );
    padding: 13px 16px;
    margin-bottom: 18px;
}

.ndc-adhesivo__calc-num {
    font-family: var( --ndc-font-head );
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
    color: var( --ndc-ink-strong );
}

.ndc-adhesivo__calc-lbl {
    font-size: 13px;
    color: var( --ndc-text );
}

.ndc-adhesivo__calc-soft {
    color: var( --ndc-muted );
}

.ndc-adhesivo__calc-arrow {
    color: #c2c6c9;
    font-size: 16px;
}

/* ----------------------------------------------------------- Producto */
.ndc-adhesivo__product {
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1px solid var( --ndc-line );
    padding: 13px 14px;
    margin-bottom: 18px;
}

.ndc-adhesivo__thumb {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    object-fit: cover;
    background: #eef0f1;
    border-radius: 2px;
}

.ndc-adhesivo__prod-info {
    flex: 1;
    min-width: 0;
}

.ndc-adhesivo__prod-name {
    font-family: var( --ndc-font-head );
    font-weight: 600;
    font-size: 14.5px;
    line-height: 1.25;
    color: var( --ndc-ink-strong );
}

.ndc-adhesivo__prod-price {
    font-size: 12.5px;
    color: var( --ndc-muted );
    margin-top: 2px;
}

/* ------------------------------------------------------------- Stepper */
.ndc-adhesivo__stepper {
    display: flex;
    align-items: center;
    border: 1.5px solid var( --ndc-line );
    flex-shrink: 0;
}

.ndc-adhesivo__step {
    width: 32px;
    height: 36px;
    border: none;
    background: var( --ndc-fill );
    color: var( --ndc-ink-strong );
    font-family: var( --ndc-font-head );
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ndc-adhesivo__step:hover {
    background: #eceeef;
}

.ndc-adhesivo__qty {
    width: 38px;
    text-align: center;
    font-family: var( --ndc-font-head );
    font-weight: 700;
    font-size: 15px;
    color: var( --ndc-ink-strong );
}

/* ------------------------------------------------------------- Botones */
.ndc-adhesivo__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    cursor: pointer;
    font-family: var( --ndc-font-head );
    font-weight: 700;
    font-size: 15.5px;
    letter-spacing: 0.03em;
    padding: 16px;
    border-radius: var( --ndc-radius );
    transition: background 0.15s ease, opacity 0.15s ease;
}

.ndc-adhesivo__btn--primary {
    background: var( --ndc-primary );
    color: var( --ndc-ink-strong );
}

.ndc-adhesivo__btn--primary:hover,
.ndc-adhesivo__btn--primary:focus-visible {
    background: var( --ndc-primary-hover );
}

.ndc-adhesivo__btn--dark {
    background: var( --ndc-ink-strong );
    color: #fff;
}

.ndc-adhesivo__btn--dark:hover,
.ndc-adhesivo__btn--dark:focus-visible {
    background: #000;
}

.ndc-adhesivo__btn[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.ndc-adhesivo__btn-total {
    font-weight: 700;
}

.ndc-adhesivo__btn-total::before {
    content: "· ";
}

.ndc-adhesivo__link {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var( --ndc-text );
    font-family: var( --ndc-font-head );
    font-weight: 600;
    font-size: 13.5px;
    padding: 14px 0 2px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}

.ndc-adhesivo__link:hover,
.ndc-adhesivo__link:focus-visible {
    color: var( --ndc-ink-strong );
}

/* --------------------------------------------------------- Vista añadido */
.ndc-adhesivo__success {
    text-align: center;
    margin-bottom: 20px;
}

.ndc-adhesivo__check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var( --ndc-primary );
    color: var( --ndc-ink-strong );
    font-size: 28px;
    margin-bottom: 13px;
}

.ndc-adhesivo__view--added .ndc-adhesivo__title {
    font-size: 21px;
    margin-bottom: 6px;
}

.ndc-adhesivo__view--added .ndc-adhesivo__msg {
    margin: 0;
    text-align: center;
    font-size: 14px;
}

.ndc-adhesivo__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var( --ndc-fill );
    padding: 13px 16px;
    margin-bottom: 18px;
    font-size: 13.5px;
    color: var( --ndc-text );
}

.ndc-adhesivo__summary-total {
    font-family: var( --ndc-font-head );
    font-weight: 700;
    font-size: 14px;
    color: var( --ndc-ink-strong );
}

/* ------------------------------------------------------------------ Chip */
.ndc-adhesivo__chip {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX( -50% );
    z-index: 999991;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var( --ndc-ink-strong );
    color: #fff;
    font-family: var( --ndc-font-head );
    font-weight: 600;
    font-size: 13px;
    padding: 11px 16px;
    border-radius: var( --ndc-radius );
    box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.25 );
    animation: ndc-adhesivo-fade 0.22s ease;
}

.ndc-adhesivo__chip button {
    background: none;
    border: none;
    color: var( --ndc-primary );
    font-family: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 0;
}

/* ----------------------------------------------------------------- Toast */
.ndc-adhesivo-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX( -50% );
    z-index: 999995;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #26292b;
    color: #fff;
    font-family: var( --ndc-font-head, "Poppins" ), system-ui, sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 13px 20px;
    border-radius: 4px;
    box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.28 );
    animation: ndc-adhesivo-toast 0.25s ease;
}

.ndc-adhesivo-toast::before {
    content: "\2713";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #f5d000;
    color: #26292b;
    font-size: 12px;
}

/* En toasts de error no mostramos el check de éxito. */
.ndc-adhesivo-toast--error::before {
    content: "!";
    background: #d9534f;
    color: #fff;
}

/* Bloqueo de scroll del fondo mientras el modal está abierto. */
body.ndc-adhesivo-lock {
    overflow: hidden;
}

/* --------------------------------------------------------------- Móvil */
@media ( max-width: 600px ) {

    /* En móvil el aviso es un panel inferior (bottom sheet). */
    .ndc-adhesivo__dialog {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -10px 40px rgba( 0, 0, 0, 0.22 );
        animation: ndc-adhesivo-sheet 0.28s ease;
        padding-bottom: env( safe-area-inset-bottom, 0 );
    }

    .ndc-adhesivo__grip {
        display: block;
        width: 38px;
        height: 4px;
        border-radius: 4px;
        background: #dcdedf;
        margin: 10px auto 4px;
    }

    .ndc-adhesivo__view {
        padding: 6px 20px 22px;
    }

    .ndc-adhesivo__title {
        font-size: 21px;
    }

    .ndc-adhesivo__chip {
        left: 16px;
        right: 16px;
        transform: none;
        justify-content: space-between;
    }
}

/* ------------------------------------------------------------ Animaciones */
@keyframes ndc-adhesivo-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes ndc-adhesivo-pop {
    from { opacity: 0; transform: translate( -50%, -50% ) scale( 0.97 ); }
    to   { opacity: 1; transform: translate( -50%, -50% ) scale( 1 ); }
}

/* El chip y el diálogo móvil usan su propia transform; animación más simple. */
@keyframes ndc-adhesivo-sheet {
    from { transform: translateY( 100% ); }
    to   { transform: translateY( 0 ); }
}

@keyframes ndc-adhesivo-toast {
    from { opacity: 0; transform: translate( -50%, 10px ); }
    to   { opacity: 1; transform: translate( -50%, 0 ); }
}

@media ( prefers-reduced-motion: reduce ) {
    .ndc-adhesivo__backdrop,
    .ndc-adhesivo__dialog,
    .ndc-adhesivo__chip,
    .ndc-adhesivo-toast {
        animation: none;
    }
}

/* ============================================================================
   Refuerzo frente a los estilos de botón del tema / Elementor / ElementsKit.
   Estos temas aplican fondo, borde, radio y padding a TODOS los <button>,
   pisando nuestro diseño (la × o el enlace salían como cajas amarillas y el
   botón principal heredaba un color erróneo). Aquí reseteamos lo justo, con la
   especificidad y los !important necesarios para que el aviso respete el diseño.
   ========================================================================== */
.ndc-adhesivo button {
    font-family: var( --ndc-font-head );
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    text-shadow: none;
    min-height: 0;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* Botón cerrar (×): aspa grande dentro de un círculo fino del mismo color. */
.ndc-adhesivo .ndc-adhesivo__close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: 1px solid currentColor !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    color: var( --ndc-muted ) !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

.ndc-adhesivo .ndc-adhesivo__close:hover,
.ndc-adhesivo .ndc-adhesivo__close:focus-visible {
    background: transparent !important;
    color: var( --ndc-ink-strong ) !important;
}

/* Stepper − / + : fondo gris claro, sin redondeos ni amarillos del tema. */
.ndc-adhesivo .ndc-adhesivo__step {
    background: var( --ndc-fill ) !important;
    color: var( --ndc-ink-strong ) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 32px !important;
    min-width: 32px !important;
    height: 36px !important;
    padding: 0 !important;
}

.ndc-adhesivo .ndc-adhesivo__step:hover {
    background: #eceeef !important;
}

/* Botones principales: ocupan todo el ancho y conservan su color de diseño. */
.ndc-adhesivo .ndc-adhesivo__btn {
    border: 0 !important;
    border-radius: var( --ndc-radius ) !important;
    box-shadow: none !important;
    width: 100% !important;
    min-height: 0 !important;
}

.ndc-adhesivo .ndc-adhesivo__btn--primary {
    background: var( --ndc-primary ) !important;
    color: var( --ndc-ink-strong ) !important;
}

.ndc-adhesivo .ndc-adhesivo__btn--primary:hover,
.ndc-adhesivo .ndc-adhesivo__btn--primary:focus-visible {
    background: var( --ndc-primary-hover ) !important;
    color: var( --ndc-ink-strong ) !important;
}

.ndc-adhesivo .ndc-adhesivo__btn--dark {
    background: var( --ndc-ink-strong ) !important;
    color: #fff !important;
}

.ndc-adhesivo .ndc-adhesivo__btn--dark:hover,
.ndc-adhesivo .ndc-adhesivo__btn--dark:focus-visible {
    background: #000 !important;
    color: #fff !important;
}

/* «Continuar sin adhesivo»: enlace discreto, nunca una caja con fondo. */
.ndc-adhesivo .ndc-adhesivo__link {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100% !important;
    min-height: 0 !important;
    color: var( --ndc-text ) !important;
    padding: 14px 0 2px !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

.ndc-adhesivo .ndc-adhesivo__link:hover,
.ndc-adhesivo .ndc-adhesivo__link:focus-visible {
    background: transparent !important;
    color: var( --ndc-ink-strong ) !important;
}

/* Título h2: conserva la fuente de títulos de la web (DM Sans, vía Elementor),
   pero fija el tamaño a 32px. Usamos doble clase para ganar a `.elementor-kit-X h2`,
   que tiene más especificidad que nuestra clase simple. No declaramos font-family
   aquí a propósito, para no pisar la tipografía heredada del tema. */
.ndc-adhesivo .ndc-adhesivo__view--open .ndc-adhesivo__title {
    font-size: 32px;
    line-height: 1.15;
}

@media ( max-width: 600px ) {
    .ndc-adhesivo .ndc-adhesivo__view--open .ndc-adhesivo__title {
        font-size: 26px;
    }
}

/* El chip «Mostrar de nuevo» tampoco debe heredar el botón del tema. */
.ndc-adhesivo .ndc-adhesivo__chip button {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: 0 !important;
    color: var( --ndc-primary ) !important;
}
