/**
 * MBP Wishlist Button Styles
 * 
 * Estilos para el botón de wishlist minimalista (solo icono)
 * Compatible con TI WooCommerce Wishlist
 * 
 * @package Manager_BotanicaPharma
 */

/* === Wrapper del botón === */
.mbp-wishlist-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

/* === Enlace clickeable (overlay) === */
.mbp-wishlist-wrapper .mbp-wishlist-button {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
}

/* === Contenedor de iconos === */
.mbp-wishlist-wrapper .mbp-wishlist-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* === Estados de los iconos === */
.mbp-wishlist-wrapper .mbp-icon-default,
.mbp-wishlist-wrapper .mbp-icon-hover,
.mbp-wishlist-wrapper .mbp-icon-active {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease-in-out;
}

.mbp-wishlist-wrapper .mbp-icon-default img,
.mbp-wishlist-wrapper .mbp-icon-hover img,
.mbp-wishlist-wrapper .mbp-icon-active img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Estado por defecto: mostrar icono default */
.mbp-wishlist-wrapper .mbp-icon-default {
    opacity: 1;
}

.mbp-wishlist-wrapper .mbp-icon-hover {
    opacity: 0;
}

.mbp-wishlist-wrapper .mbp-icon-active {
    opacity: 0;
}

/* Estado hover: mostrar icono hover */
.mbp-wishlist-wrapper:hover .mbp-icon-default {
    opacity: 0;
}

.mbp-wishlist-wrapper:hover .mbp-icon-hover {
    opacity: 1;
}

.mbp-wishlist-wrapper:hover .mbp-icon-active {
    opacity: 0;
}

/* Estado activo (en wishlist): mostrar icono activo (corazón lleno) */
.mbp-wishlist-wrapper.in-wishlist .mbp-icon-default,
.mbp-wishlist-wrapper .tinvwl-product-in-list ~ .mbp-wishlist-icons .mbp-icon-default {
    opacity: 0;
}

.mbp-wishlist-wrapper.in-wishlist .mbp-icon-hover,
.mbp-wishlist-wrapper .tinvwl-product-in-list ~ .mbp-wishlist-icons .mbp-icon-hover {
    opacity: 0;
}

.mbp-wishlist-wrapper.in-wishlist .mbp-icon-active,
.mbp-wishlist-wrapper .tinvwl-product-in-list ~ .mbp-wishlist-icons .mbp-icon-active {
    opacity: 1;
}

/* Hover cuando está en wishlist: mostrar icono default (vacío) para indicar que se puede eliminar */
.mbp-wishlist-wrapper.in-wishlist:hover .mbp-icon-active {
    opacity: 0;
}

.mbp-wishlist-wrapper.in-wishlist:hover .mbp-icon-default {
    opacity: 1;
}

/* === Ocultar elementos generados por TI Wishlist === */
.mbp-wishlist-wrapper .tinvwl-icon-heart::before {
    display: none !important;
}

/* === Integración con Elementor Share Buttons === */
.elementor-share-btn .mbp-wishlist-wrapper {
    width: 100%;
    height: 100%;
}

.elementor-share-btn .mbp-wishlist-icons img {
    width: 20px;
    height: 20px;
}

/* === Loading state === */
.mbp-wishlist-wrapper.tinvwl-waiting,
.mbp-wishlist-wrapper.mbp-loading {
    pointer-events: none;
}

.mbp-wishlist-wrapper.tinvwl-waiting .mbp-wishlist-icons,
.mbp-wishlist-wrapper.mbp-loading .mbp-wishlist-icons {
    animation: mbp-pulse 1s infinite;
}

@keyframes mbp-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */
.mbp-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.mbp-toast.mbp-toast-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.mbp-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.mbp-toast-icon {
    font-size: 18px;
    line-height: 1;
}

.mbp-toast-message {
    line-height: 1.4;
}

/* Toast variants */
.mbp-toast.mbp-toast-added .mbp-toast-content {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.mbp-toast.mbp-toast-removed .mbp-toast-content {
    background: linear-gradient(135deg, #666 0%, #555 100%);
}

.mbp-toast.mbp-toast-error .mbp-toast-content {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

/* Toast en móvil */
@media (max-width: 768px) {
    .mbp-toast {
        bottom: 20px;
        left: 20px;
        right: 20px;
        transform: translateX(0) translateY(100px);
    }
    
    .mbp-toast.mbp-toast-visible {
        transform: translateX(0) translateY(0);
    }
    
    .mbp-toast-content {
        justify-content: center;
        padding: 12px 20px;
    }
}

/* === Responsive === */
@media (max-width: 768px) {
    .mbp-wishlist-wrapper {
        width: 36px;
        height: 36px;
    }
    
    .mbp-wishlist-wrapper .mbp-icon-default img,
    .mbp-wishlist-wrapper .mbp-icon-hover img,
    .mbp-wishlist-wrapper .mbp-icon-active img {
        width: 20px;
        height: 20px;
    }
}

/* ===========================================
   OCULTAR ELEMENTOS NATIVOS DE TI WISHLIST
   cuando se usa junto con mbp-wishlist-wrapper
   =========================================== */

/* Ocultar el segundo botón (product-wishlist-button) de TI Wishlist */
.elementor-shortcode .tinv-wraper.product-wishlist-button,
.mbp-wishlist-wrapper ~ .tinv-wraper.product-wishlist-button,
.mbp-wishlist-wrapper + .tinv-wraper {
    display: none !important;
}

/* Ocultar textos y estados del botón nativo */
.elementor-shortcode .tinv-wraper .state,
.elementor-shortcode .tinv-wraper p.not-added,
.elementor-shortcode .tinv-wraper p.added {
    display: none !important;
}

/* Ocultar iconos duplicados del wrapper original de TI Wishlist */
.elementor-shortcode .tinv-wraper.circle-button .icons-wrapper {
    display: none !important;
}

/* Cuando SOLO queremos el botón circular de TI Wishlist (sin nuestro wrapper) */
.tinv-wraper.circle-button:not(.mbp-wishlist-wrapper) .icons-wrapper {
    display: flex;
}

/* Asegurar que solo se muestre UN botón wishlist por contenedor */
.elementor-shortcode > .tinv-wraper:not(:first-child) {
    display: none !important;
}
