/* ============================================================
   Product Add to Cart Widget — Beps PuroOmega Widgets
   ============================================================ */

/* ── 1. CONTENEDOR GENERAL ──────────────────────────────────── */
.beps-atc-form { margin: 0; }

.beps-atc-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* ── 2. CANTIDAD ─────────────────────────────────────────────── */
.beps-atc-qty-wrap {
    display: flex;
    align-items: center;
    width: 126px;
    min-width: 126px;
    max-width: 126px;
    height: 51px;
    border: 1px solid #E8E8E8;
    border-radius: 50px;
    overflow: hidden;
    background-color: #ffffff;
    box-sizing: border-box;
    flex-shrink: 0;
}

.beps-atc-qty-btn {
    flex: 0 0 36px;
    height: 100%;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #141436;
    padding: 0;
    /* Sin transición — hover gestionado desde Elementor */
}

/* Reset del hover del tema: anula el color morado/violeta heredado */
.beps-atc-qty-btn:hover,
.beps-atc-qty-btn:focus {
    background: none !important;
    color: #141436 !important;
    box-shadow: none !important;
    outline: none !important;
}

.beps-atc-qty-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #141436;
    background: transparent;
    -moz-appearance: textfield;
    padding: 0;
    border-radius: 0 !important;
}

.beps-atc-qty-input::-webkit-outer-spin-button,
.beps-atc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── 3. BOTÓN COMPARTIR ─────────────────────────────────────── */
.beps-atc-share-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* Popup de opciones */
.beps-atc-share-popup {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: #ffffff;
    border: 1px solid #EBEBEB;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(19, 15, 50, 0.13);
    padding: 6px;
    min-width: 188px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.beps-atc-share-popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Triángulo decorativo apuntando hacia abajo */
.beps-atc-share-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: #ffffff;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.06));
}

.beps-atc-share-option {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #130F32;
    text-decoration: none !important;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    white-space: nowrap;
    transition: background 0.14s ease, color 0.14s ease;
    line-height: 1.2;
}

.beps-atc-share-option:hover {
    background: #F5F5FA;
    color: #130F32 !important;
    text-decoration: none !important;
}

/* Botón "Copiar enlace" — estilos específicos */
.beps-atc-share-copy {
    display: flex !important;
    align-items: center;
    border: 1px solid #130F32 !important;
    color: #130F32 !important;
    margin-top: 4px;
}

.beps-atc-share-copy svg {
    stroke: #130F32;
}

.beps-atc-share-copy:hover {
    background: #130F32 !important;
    color: #ffffff !important;
}

.beps-atc-share-copy:hover svg {
    stroke: #ffffff;
}

.beps-atc-share-option svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    display: block;
}

/* El SVG de WhatsApp usa fill directo, los demás usan stroke */
.beps-atc-share-option--wa svg { stroke: none; }

.beps-atc-share {
    width: 51px;
    height: 51px;
    min-width: 51px;
    border: none !important;
    border-radius: 50% !important;
    background-color: #ffffff;
    color: inherit !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    flex-shrink: 0;
    box-sizing: border-box;
    font-size: inherit !important;
    transition: none !important;
    text-align: initial !important;
    white-space: normal !important;
}

.beps-atc-share svg,
.beps-atc-share i {
    display: block;
    pointer-events: none;
}

/* ── 4. BOTÓN AÑADIR AL CARRITO ─────────────────────────────── */
.beps-atc-btn {
    flex: 1 1 auto;
    max-width: 462px;
    height: 51px;
    background-color: #F6C927;
    color: #141436;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 400!important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px;
    padding: 0 28px;
    text-align: center;
    box-sizing: border-box;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.beps-atc-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.beps-atc-btn-icon svg {
    display: block;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.beps-atc-btn-icon i {
    display: block;
    pointer-events: none;
    line-height: 1;
}

.beps-atc-btn-label {
    display: block;
    line-height: 1;
}

/* ── 5. LOADING STATE (WooCommerce AJAX) ─────────────────────── */
.beps-atc-btn.loading {
    opacity: 1 !important;
    pointer-events: none !important;
    background-color: #F6C927 !important;
    color: #141436 !important;
    position: relative !important;
}

/* Suprimir el engranaje de WooCommerce — reemplazar con spinner limpio centrado */
.beps-atc-btn.loading::after {
    content: '' !important;
    font-family: inherit !important;
    font-size: 0 !important;
    width: 20px !important;
    height: 20px !important;
    border: 2px solid rgba(20, 20, 54, 0.25) !important;
    border-top-color: #141436 !important;
    border-radius: 50% !important;
    animation: bepsAtcSpin 0.7s linear infinite !important;
    position: absolute !important;
    top: calc(50% - 10px) !important;
    left: calc(50% - 10px) !important;
    right: auto !important;
    vertical-align: unset !important;
}

.beps-atc-btn.loading .beps-atc-btn-label,
.beps-atc-btn.loading .beps-atc-btn-icon { visibility: hidden; }

@keyframes bepsAtcSpin { to { transform: rotate(360deg); } }

.beps-atc-btn.added { opacity: 0.8; }

/* ── 6. MOBILE — fixed bottom bar ───────────────────────────── */
@media (max-width: 767px) {
    /* Espacio en el body para que el fixed bar no tape contenido */
    body {
        padding-bottom: 80px !important;
    }

    .beps-atc-form {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 9999;
        background: #ffffff;
        /* padding-bottom respeta el home indicator de iOS */
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
        box-sizing: border-box;
        margin: 0;
    }

    /* Botón compartir oculto en mobile */
    .beps-atc-share-wrap {
        display: none !important;
    }

    /* El botón ocupa todo el ancho disponible */
    .beps-atc-btn {
        flex: 1 1 auto;
        max-width: none;
    }
}
