/* Plugin Kubo Add to Cart Basic - CSS */

/* Botón principal */
.kubo-add-to-cart-btn {
    border: 2px solid #fab000;
    border-radius: 8px;
    color: #ffffff;
    background-color: #fab000;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    padding: 8px 24px;
    width: 124px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    outline: none;
}

.kubo-add-to-cart-btn:hover {
    background-color: #ffffff;
    color: #fab000;
}

.kubo-add-to-cart-btn:active,
.kubo-add-to-cart-btn:focus {
    outline: none;
}

.kubo-add-to-cart-btn.kubo-btn-clicked {
    transform: scale(0.95);
    transition: transform 0.1s ease;
    border-color: #e6a000 !important;
}

.kubo-add-to-cart-btn:disabled,
.kubo-add-to-cart-btn.kubo-out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #cccccc !important;
    border-color: #cccccc !important;
    color: #666666 !important;
}

.kubo-add-to-cart-btn.kubo-out-of-stock:hover {
    background-color: #cccccc !important;
    border-color: #cccccc !important;
    color: #666666 !important;
}

.kubo-full-width {
    width: 100%;
}

/* Responsive para el botón */
@media (max-width: 768px) {
    .kubo-add-to-cart-btn {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

/* Deshabilitar scroll cuando el modal está abierto */
body.kubo-modal-open {
    overflow: hidden !important;
    /* Prevenir scroll en iOS Safari */
    -webkit-overflow-scrolling: touch;
    /* Prevenir scroll con overscroll-behavior */
    overscroll-behavior: none;
    /* Prevenir scroll en todos los navegadores */
    position: relative;
}

/* Prevenir zoom en dispositivos móviles cuando el modal está abierto */
@media (max-width: 767px) {
    body.kubo-modal-open {
        /* Prevenir zoom por doble tap */
        touch-action: manipulation;
        /* Prevenir zoom por gestos de pellizco */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        /* Prevenir zoom por viewport */
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    /* Prevenir zoom específicamente en el overlay del modal */
    .kubo-bottom-sheet-overlay.active {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Prevenir zoom en el contenido del modal */
    .kubo-bottom-sheet-overlay.active .kubo-bottom-sheet {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Clase adicional para prevenir zoom cuando el modal está abierto */
    body.kubo-zoom-prevented {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    body.kubo-zoom-prevented * {
        touch-action: manipulation;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Prevenir scroll en el overlay también */
.kubo-bottom-sheet-overlay {
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
}

/* Bottom Sheet Overlay */
.kubo-bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 250;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.kubo-bottom-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Bottom Sheet */
.kubo-bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    /* Prevenir scroll en el modal */
    -webkit-overflow-scrolling: touch;
}

.kubo-sale-badge-modal {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.kubo-close-btn-modal {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: none;
    border: none;
    font-size: 24px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.kubo-close-btn-modal:hover {
    background-color: #f0f0f0;
    color: #fa010a;
}

.kubo-bottom-sheet-overlay.active .kubo-bottom-sheet {
    transform: translateY(0);
}

/* Close Row */
.kubo-bottom-sheet-close-row {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px 0;
}

.kubo-bottom-sheet-close {
    background: none;
    border: none;
    font-size: 24px;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    color: #666;
    padding: 8px;
    margin: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.kubo-bottom-sheet-close:hover {
    background-color: #f0f0f0;
}

/* Image Row */
.kubo-bottom-sheet-image-row {
    display: block;
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
    overflow: hidden;
}

.kubo-image-container {
    position: relative;
    display: block;
    width: 100%;
}

.kubo-product-image-main {
    width: 100%;
    height: 290px;
    margin-top: -95px;
    object-fit: cover;
    display: block;
}

/* Sobrescribir reglas de WooCommerce para la imagen del modal */
.kubo-bottom-sheet .kubo-product-image-main {
    height: 290px !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Main Content */
.kubo-bottom-sheet-main {
    padding: 16px 16px;
    /* Permitir scroll interno si es necesario */
    max-height: calc(80vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Prevenir que el scroll interno afecte al body */
    overscroll-behavior: contain;
}

/* Desktop Layout */
.kubo-desktop-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0px;
    align-items: stretch;
    height: 100%;
}

.kubo-col-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.kubo-col-right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Product Info */
.kubo-product-name {
    font-weight: 600;
    font-size: 1.5rem;
    font-family: 'Montserrat', sans-serif;
    color: #333;
    margin-bottom: 4px;
    line-height: 1;
}

.kubo-product-price {
    font-weight: 700;
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    color: #333;
    margin-bottom: 0;
}

.kubo-subtotal {
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    color: #666;
    margin-bottom: 16px;
}

/* Rating */
.kubo-rating-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 24px;
}

.kubo-stars {
    display: flex;
    align-items: center;
    gap: 1px;
}

.kubo-star {
    font-size: 1rem;
    line-height: 1;
    color: #ddd;
}

.kubo-star.kubo-star-filled {
    color: #fab000 !important;
}

.kubo-star-partial {
    position: relative;
    color: #ddd;
}

.kubo-star-partial::before {
    content: '★';
    position: absolute;
    top: 0;
    left: 0;
    color: #fab000;
    width: var(--fill-percentage);
    overflow: hidden;
}

.kubo-star.kubo-star-empty {
    color: #ddd !important;
}

.kubo-rating-text {
    color: #666;
    font-size: 0.85rem;
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
}

.kubo-rating-number {
    color: #202020;
    font-weight: 700;
}

.kubo-no-rating {
    color: #999;
    font-style: italic;
    font-family: 'Montserrat', sans-serif;
}

/* View Row */
.kubo-view-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}

.kubo-view-product-btn {
    background-color: transparent;
    color: #fab000;
    border: 2px solid #fab000;
    border-radius: 8px;
    padding-top: 10px;
    padding-bottom: 9px;
    padding-left: 16px;
    padding-right: 16px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    flex: 1;
    margin-top: 24px;
}

.kubo-view-product-btn:hover {
    background-color: #fab000;
    color: #ffffff;
}

.kubo-fav-container {
    flex-shrink: 0;
    margin-left: -3px;
    margin-right: 2px;
    margin-bottom: -16px;
    margin-top: 6px;
}

/* Presets */
.kubo-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
}

.kubo-preset-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.kubo-preset-btn:hover {
    background-color: #fab000;
    color: #ffffff;
    border-color: #fab000;
}

/* Quantity Control */
.kubo-quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    width: 100%;
}

.kubo-quantity-input-wrapper {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
}

.kubo-quantity-input-wrapper::after {
    content: 'g';
    position: absolute;
    top: 55%;
    transform: translateY(-50%);
    color: #666;
    font-size: 1rem;
    font-weight: 400;
    pointer-events: none;
    z-index: 1;
    margin-left: 15px;
    left: var(--suffix-left);
}

.kubo-quantity-btn {
    background-color: #ffffff;
    border: 2px solid #ddd !important;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    font-size: 1.8rem;
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    line-height: 1;
}

/* Colores específicos para los botones */
.kubo-quantity-btn[data-action="decrease"] {
    color: #fa010a;
}

.kubo-quantity-btn[data-action="increase"] {
    color: #fab000;
}

.kubo-quantity-btn[data-action="decrease"] {
    color: #fa010a;
}

.kubo-quantity-btn[data-action="increase"] {
    color: #fab000;

}

.kubo-quantity-btn:hover[data-action="decrease"] {
    border-color: #fa010a !important;
}

.kubo-quantity-btn:hover[data-action="increase"] {
    border-color: #fab000 !important;
}

/* Estilos para botones deshabilitados */
.kubo-quantity-btn-disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background-color: #f5f5f5 !important;
    border-color: #ddd !important;
}

.kubo-quantity-btn-disabled::before {
    opacity: 0.4 !important;
}

.kubo-quantity-btn-disabled:hover {
    border-color: #ddd !important;
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
}

.kubo-quantity-input {
    text-align: center;
    width: 100%;
    height: 36px;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    text-align: center;
    padding-right: 0;
    font-size: 1rem;
    font-weight: 400;
    font-family: 'Montserrat', sans-serif;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    flex: 1;
    min-width: 0;
    background-color: #f8f9fa !important;
    cursor: default !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

.kubo-quantity-input::-webkit-outer-spin-button,
.kubo-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to Cart Button Sheet */
.kubo-add-to-cart-btn-sheet {
    background-color: #fab000;
    color: #ffffff;
    border: 2px solid #fab000;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.kubo-add-to-cart-btn-sheet:hover {
    background-color: #ffffff;
    color: #fab000;
}

/* Estado de éxito del botón */
.kubo-add-to-cart-btn-sheet-success {
    background-color: #28a745 !important;
    color: #ffffff !important;
    border-color: #28a745 !important;
    cursor: default !important;
    border: 2px solid #28a745 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.kubo-add-to-cart-btn-sheet-success:hover {
    background-color: #28a745 !important;
    color: #ffffff !important;
    border-color: #28a745 !important;
}

/* Botón ver carrito */
.kubo-view-cart-btn {
    background-color: transparent;
    color: #fab000;
    border: 2px solid #fab000;
    border-radius: 8px 8px 0 0;
    padding: 8px 16px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 200px;
    margin-top: 0;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    border-bottom: none;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.kubo-view-cart-btn:hover {
    background-color: #fab000;
    color: #ffffff;
    box-shadow: 0 -2px 12px rgba(250, 176, 0, 0.3);
}

/* Ocultar botón ver carrito en mobile */
@media (max-width: 767px) {
    .kubo-view-cart-btn {
        display: none !important;
    }
    .kubo-quantity-input-wrapper::after {
        top: 54%;
        margin-left: calc(50% + 16px);
        left: var(--suffix-left);
    }
}

/* Mobile Layout */
.kubo-mobile-layout {
    display: none;
}

/* Responsive sizing */
@media (max-width: 767px) {
    .kubo-bottom-sheet {
        position: absolute;
        bottom: 70px;
        left: 0;
        top: auto;
        transform: translateY(100%);
        width: 100%;
        min-height: 200px;
        max-height: calc(90vh - 140px);
        border-radius: 8px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }

    .kubo-fav-container {
        flex-shrink: 0;
        margin-left: -6px;
        margin-right: -2px;
        margin-bottom: -18px;
        margin-top: 6px;
    }

    .kubo-rating-container {
        gap: 4px;
    }

    .kubo-rating-text {
        font-size: 0.75rem;
    }

    .kubo-star {
        gap: 0px;
    }

    .kubo-product-name {
        font-size: 1.25rem;
    }
    
    .kubo-bottom-sheet-overlay.active .kubo-bottom-sheet {
        transform: translateY(0);
    }
    
    .kubo-product-image-main {
        width: 100%;
        height: 190px;
        margin-top: -80px;
        object-fit: cover;
    }
    
    /* Sobrescribir reglas de WooCommerce para la imagen del modal en móviles */
    .kubo-bottom-sheet .kubo-product-image-main {
        height: 190px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .kubo-bottom-sheet-image-row {
        padding: 0;
    }
    
    .kubo-desktop-layout {
        display: none;
    }
    
    .kubo-mobile-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .kubo-bottom-sheet {
        position: absolute;
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%) scale(0.8);
        width: 500px;
        min-height: 400px;
        max-height: 90vh;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    }
    
    .kubo-product-image-main {
        width: 100%;
        height: 290px;
        margin-top: -95px;
        object-fit: cover;
    }
    
    /* Sobrescribir reglas de WooCommerce para la imagen del modal en tablet */
    .kubo-bottom-sheet .kubo-product-image-main {
        height: 290px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .kubo-bottom-sheet-overlay.active .kubo-bottom-sheet {
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (min-width: 1025px) {
    .kubo-bottom-sheet {
        position: absolute;
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%) scale(0.8);
        width: 500px;
        min-height: 400px;
        max-height: 90vh;
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    }
    
    .kubo-product-image-main {
        width: 100%;
        height: 290px;
        margin-top: -95px;
        object-fit: cover;
    }
    
    /* Sobrescribir reglas de WooCommerce para la imagen del modal en desktop */
    .kubo-bottom-sheet .kubo-product-image-main {
        height: 290px !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .kubo-bottom-sheet-overlay.active .kubo-bottom-sheet {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Loading state para el modal */
.kubo-bottom-sheet-overlay.loading {
    background-color: rgba(0, 0, 0, 0.5);
}

.kubo-bottom-sheet-overlay.loading .kubo-bottom-sheet {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.kubo-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #fab000;
    border-radius: 50%;
    animation: kubo-spin 1s linear infinite;
}

@keyframes kubo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notificaciones */
.kubo-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: #ffffff;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kubo-notification-show {
    transform: translateX(0);
}

.kubo-notification-success {
    background-color: #28a745;
    border-left: 4px solid #1e7e34;
}

.kubo-notification-error {
    background-color: #dc3545;
    border-left: 4px solid #c82333;
}

/* Responsive para notificaciones */
@media (max-width: 767px) {
    .kubo-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .kubo-notification-show {
        transform: translateY(0);
    }
}
