/* Estilos minimalistas para bestseller cards */
.bestseller-card {
    transition: all 0.3s ease;
}

.bestseller-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12) !important;
}

/* Ocultar el tag "Producto Pro" */
.bestseller-tag {
    display: none !important;
}

/* Descripción truncada a una línea */
.bestseller-description {
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
}

/* Botón minimalista "Ver detalle" */
.btn-detail-minimal {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #1946AB;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 8px 0;
}

.btn-detail-minimal:hover {
    color: #3366CC;
    gap: 8px;
}

.btn-detail-minimal i {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.btn-detail-minimal:hover i {
    transform: translateX(3px);
}

/* Botón de WhatsApp verde en el modal */
.btn-whatsapp-modal {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    border: 2px solid transparent !important;
    color: white !important;
    font-weight: 700 !important;
    padding: 12px 30px !important;
    font-size: 1.05rem !important;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4) !important;
    transition: all 0.3s ease !important;
}

.btn-whatsapp-modal:hover {
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%) !important;
    border-color: #25D366 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5) !important;
}

.btn-whatsapp-modal i {
    font-size: 1.2rem;
}

/* Mejoras al modal de producto */
#productModal .modal-content {
    border-radius: 24px !important;
    overflow: hidden;
    border: 1.5px solid #1946AB;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

#productModal .modal-header {
    border-bottom: 2px solid #f0f4ff;
    padding: 1rem 1.5rem;
}

#productModal .btn-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #1946AB !important;
    opacity: 1 !important;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

#productModal .btn-close:hover {
    background-color: #3366CC !important;
    opacity: 1 !important;
}

#productModal .btn-close::before {
    color: white !important;
    font-size: 1.2rem;
    line-height: 1;
}

#productModal .modal-backdrop.show {
    background-color: rgba(13, 43, 95, 0.5) !important;
    backdrop-filter: blur(4px);
}

#productModal .modal-body {
    padding: 2rem !important;
}

#productModal #modalProductImage {
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    width: 100%;
    height: auto;
    object-fit: contain;
}

#productModal #modalProductName {
    font-size: 2rem;
    font-weight: 800;
    color: #1946AB;
    margin-bottom: 1rem;
}

#productModal #modalProductDescription {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #2c3e50;
}

#productModal #modalProductPrice {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #1946AB 0%, #3366CC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Fix modal z-index - modal must be above navbar (z-index: 1000001) */
#productModal.modal {
    z-index: 1000010 !important;
}

#productModal .modal-backdrop {
    z-index: 1000005 !important;
}

/* Measure item in modal */
.measures-list-modal {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.measure-item-modal {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #f0f4ff;
    border: 1.5px solid #1946AB;
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.measure-item-modal:hover {
    border-color: #1946AB;
    background: #f0f4ff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(25, 70, 171, 0.2);
}

.measure-item-modal .measure-name {
    font-weight: 600;
    color: #1946AB;
    font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .btn-whatsapp-modal {
        width: 100%;
        margin-top: 1rem;
    }

    #productModal #modalProductPrice {
        font-size: 2rem;
    }

    #productModal .d-flex {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    /* Mobile: adjust modal margin to not be hidden by navbar */
    #productModal .modal-dialog {
        margin-top: 80px !important;
    }

    .measure-item-modal {
        padding: 6px 10px;
    }

    .measure-item-modal .measure-name {
        font-size: 0.8rem;
    }
}

/* Desktop: ensure modal is not hidden by navbar */
@media (min-width: 769px) {
    #productModal .modal-dialog {
        margin-top: 100px !important;
    }
}

/* ==================== BESTSELLERS MOBILE AUTO-SCROLL ==================== */

@media (max-width: 991px) {
    /* Mobile: convert grid to horizontal scroll container */
    .bestsellers-grid {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 20px !important;
        gap: 20px !important;
        /* Remove grid-specific properties */
        grid-template-columns: unset !important;
        align-items: stretch !important;
    }

    .bestsellers-grid::-webkit-scrollbar {
        display: none !important;
    }

    /* Each card should be a fixed-width slide */
    .bestsellers-grid > div {
        flex: 0 0 280px !important;
        min-width: 280px !important;
        width: 280px !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Clone wrapper */
    .bestseller-clone-wrapper {
        display: contents !important;
    }

    .bestseller-clone-wrapper > div {
        flex: 0 0 280px !important;
        min-width: 280px !important;
        width: 280px !important;
    }

    /* Dots indicator - visible on mobile only */
    .bestsellers-dots {
        display: flex !important;
        justify-content: center;
        gap: 8px;
        margin-top: 15px;
    }

    .bestsellers-dots .dot {
        width: 12px !important;
        height: 12px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.3);
        cursor: pointer;
        transition: all 0.3s ease;
        border: 2px solid transparent;
    }

    .bestsellers-dots .dot.active {
        background: #fff !important;
        transform: scale(1.2);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
        border-color: rgba(255, 255, 255, 0.5);
    }
}

/* Mensaje para productos sin medidas */
.no-measures-message {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fff3e0 0%, #fff8f0 100%);
    border: 1.5px solid #ff9800;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #e65100;
    transition: all 0.3s ease;
}

.no-measures-message i {
    font-size: 0.9rem;
    color: #ff9800;
}

.bestseller-card:hover .no-measures-message {
    background: linear-gradient(135deg, #ffe0b2 0%, #fff3e0 100%);
    border-color: #e65100;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 152, 0, 0.2);
}