/* Mobile Product Card Improvements */
/* Optimizaciones específicas para la visualización de productos en móviles */

/* ===============================================
   MOBILE PRODUCT CARDS - BETTER IMAGE DISPLAY
   =============================================== */

@media (max-width: 768px) {
    /* Contenedor principal del producto */
    .cr-product-box {
        padding: 8px !important;
        margin-bottom: 16px !important;
    }
    
    .cr-product-card {
        padding: 10px !important;
        border-radius: 12px !important;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1) !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    }
    
    .cr-product-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
    }
    
    /* Imagen del producto - MÁS GRANDE y COVER - SOLO para vista de grilla */
    .cr-product-image:not(.col-100.col-size .cr-product-image) {
        height: 240px !important;
        min-height: 240px !important;
        border-radius: 10px !important;
        background: none !important;
        padding: 0 !important;
        margin-bottom: 12px !important;
        overflow: hidden !important;
    }
    
    .cr-product-image:not(.col-100.col-size .cr-product-image) img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 10px !important;
        transition: transform 0.3s ease !important;
    }
    
    .cr-product-image:not(.col-100.col-size .cr-product-image):hover img {
        transform: scale(1.05) !important;
    }
    
    /* Detalles del producto - MÁS COMPACTOS - SOLO para vista de grilla */
    .cr-product-details:not(.col-100.col-size .cr-product-details) {
        padding-top: 8px !important;
        text-align: center !important;
    }
    
    /* Categoría más pequeña - SOLO para vista de grilla */
    .cr-brand:not(.col-100.col-size .cr-brand) a {
        font-size: 10px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 6px !important;
        opacity: 0.8 !important;
    }
    
    /* Título más compacto pero legible - SOLO para vista de grilla */
    .cr-product-details:not(.col-100.col-size .cr-product-details) .title {
        font-size: 13px !important;
        line-height: 1.3 !important;
        font-weight: 600 !important;
        margin-bottom: 8px !important;
        color: #2b2b2d !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        min-height: 34px !important;
    }
    
    /* Precio más destacado pero compacto - SOLO para vista de grilla */
    .cr-price:not(.col-100.col-size .cr-price) {
        font-size: 15px !important;
        margin-bottom: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
    }
    
    .cr-price:not(.col-100.col-size .cr-price) .new-price {
        font-size: 15px !important;
        font-weight: 700 !important;
        color: #f44336 !important;
    }
    
    .cr-price:not(.col-100.col-size .cr-price) .old-price {
        font-size: 12px !important;
        opacity: 0.6 !important;
    }
    
    /* Botón más compacto pero atractivo - SOLO para vista de grilla */
    .cart_btn:not(.col-100.col-size .cart_btn) {
        margin-top: 8px !important;
    }
    
    .cart_btn:not(.col-100.col-size .cart_btn) .cr-btn-secondary {
        height: 34px !important;
        padding: 8px 16px !important;
        font-size: 12px !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        transition: all 0.2s ease !important;
    }
    
    .cart_btn:not(.col-100.col-size .cart_btn) .cr-btn-secondary:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3) !important;
    }
    
    /* Botones de acción lateral más visibles */
    .cr-side-view {
        opacity: 1 !important;
        right: 10px !important;
        top: 10px !important;
        gap: 6px !important;
    }
    
    .cr-side-view .wishlist,
    .cr-side-view .model-oraganic-product {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        backdrop-filter: blur(10px) !important;
        background: rgba(255, 255, 255, 0.9) !important;
    }
    
    .cr-side-view .wishlist i,
    .cr-side-view .model-oraganic-product i {
        font-size: 14px !important;
    }
    
    /* Botón de carrito flotante */
    .cr-shopping-bag {
        width: 32px !important;
        height: 32px !important;
        bottom: -16px !important;
        right: 10px !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(244, 67, 54, 0.2) !important;
        background: #f44336 !important;
        border: 2px solid #fff !important;
    }
    
    .cr-shopping-bag i {
        color: #fff !important;
        font-size: 14px !important;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 480px) {
    .cr-product-image {
        height: 220px !important;
        min-height: 220px !important;
    }
    
    .cr-product-details .title {
        font-size: 12px !important;
        min-height: 32px !important;
    }
    
    .cr-price {
        font-size: 14px !important;
    }
    
    .cr-price .new-price {
        font-size: 14px !important;
    }
    
    .cart_btn .cr-btn-secondary {
        height: 32px !important;
        font-size: 11px !important;
        padding: 6px 14px !important;
    }
}

/* ===============================================
   MOBILE GRID IMPROVEMENTS
   =============================================== */

@media (max-width: 768px) {
    /* Grid de 2 columnas más balanceado - SOLO para vista de grilla */
    .col-100:not(.col-size) .cr-product-box,
    .cr-product-box:not(.col-100 .cr-product-box) {
        width: calc(50% - 8px) !important;
        margin: 4px !important;
        flex: 0 0 calc(50% - 8px) !important;
    }
    
    /* Para vista de lista (ancho completo) mantener el diseño optimizado */
    .col-100.col-size .cr-product-box {
        width: 100% !important;
        margin: 0 0 16px 0 !important;
        flex: 0 0 100% !important;
    }
    
    /* Remover estilos flotantes obsoletos - ahora usamos flexbox */
    .col-100.col-size .cr-product-box .cr-product-image {
        /* Estilos manejados en la sección específica para vista de lista */
        height: auto !important;
        min-height: auto !important;
        width: auto !important;
        float: none !important;
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Remover estilos flotantes obsoletos - ahora usamos flexbox */
    .col-100.col-size .cr-product-box .cr-product-details {
        /* Estilos manejados en la sección específica para vista de lista */
        width: auto !important;
        float: none !important;
        text-align: center !important;
        padding-top: 0 !important;
    }
    
    /* Limpiar floats en vista de lista */
    .col-100.col-size .cr-product-box .cr-product-card::after {
        content: "" !important;
        display: table !important;
        clear: both !important;
    }
    
    /* Contenedor de productos */
    #products-container {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 0 !important;
    }
    
    /* Para vista de lista, cambiar a columna única */
    .col-100.col-size #products-container {
        flex-direction: column !important;
        justify-content: flex-start !important;
    }
}

@media (max-width: 360px) {
    /* Para pantallas muy pequeñas, mantener 2 columnas pero más compactas */
    .cr-product-box {
        width: calc(50% - 6px) !important;
        margin: 3px !important;
        flex: 0 0 calc(50% - 6px) !important;
    }
    
    .cr-product-card {
        padding: 8px !important;
    }
    
    .cr-product-image {
        height: 200px !important;
        min-height: 200px !important;
        padding: 6px !important;
    }
}

/* ESTILOS ESPECÍFICOS PARA VISTA DE LISTA (elementos más grandes) - CON MÁXIMA ESPECIFICIDAD */
@media only screen and (max-width: 991px) {
    /* Restructurar completamente la vista de lista para layout horizontal */
    .col-100.col-size .cr-product-box {
        width: 100% !important;
        margin: 0 0 16px 0 !important;
    }
    
    /* FORZAR layout horizontal en vista de lista con máxima especificidad */
    .col-100.col-size .cr-product-box .cr-product-card {
        display: flex !important;
        flex-direction: row !important;
        padding: 12px !important;
        width: 100% !important;
        align-items: stretch !important;
        min-height: 160px !important;
        height: auto !important;
        justify-content: flex-start !important;
    }
    
    /* OVERRIDE cualquier flex-direction: column en lista */
    .col-100.col-size .cr-product-box .cr-product-card,
    .col-100.col-size .cr-product-card {
        flex-direction: row !important;
    }
    
    /* Imagen MÁS ANCHA y protagonista - 60% del ancho - OCUPA TODO EL ALTO */
    .col-100.col-size .cr-product-box .cr-product-image {
        width: 60% !important;
        height: 100% !important;
        min-height: 100% !important;
        max-height: none !important;
        margin: 0 16px 0 0 !important;
        flex-shrink: 0 !important;
        border-radius: 12px !important;
        background: none !important;
        padding: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .col-100.col-size .cr-product-box .cr-product-image .cr-image-inner {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 12px !important;
        overflow: hidden !important;
    }
    
    .col-100.col-size .cr-product-box .cr-product-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 12px !important;
    }
    
    /* Contenido más compacto - solo 40% del espacio - CENTRADO EN MÓVIL */
    .col-100.col-size .cr-product-details {
        width: 40% !important;
        flex: 1 !important;
        text-align: center !important;
        padding: 4px 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding-top: 4px !important;
    }
    
    /* Categoría más compacta - CENTRADA EN MÓVIL */
    .col-100.col-size .cr-brand a {
        font-size: 10px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.2px !important;
        margin-bottom: 2px !important;
        opacity: 0.7 !important;
        display: block !important;
        text-align: center !important;
    }
    
    /* Título más compacto - CENTRADO EN MÓVIL */
    .col-100.col-size .cr-product-details .title {
        font-size: 15px !important;
        line-height: 1.2 !important;
        font-weight: 600 !important;
        margin-bottom: 6px !important;
        color: #2b2b2d !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        min-height: 36px !important;
        text-align: center !important;
    }
    
    /* Precio más compacto - CENTRADO EN MÓVIL */
    .col-100.col-size .cr-price {
        font-size: 17px !important;
        margin-bottom: 8px !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        text-align: center !important;
    }
    
    .col-100.col-size .cr-price .new-price {
        font-size: 17px !important;
        font-weight: 700 !important;
        color: #f44336 !important;
    }
    
    .col-100.col-size .cr-price .old-price {
        font-size: 14px !important;
        opacity: 0.6 !important;
        text-decoration: line-through !important;
    }
    
    /* Botón más compacto - CENTRADO EN MÓVIL */
    .col-100.col-size .cart_btn {
        margin-top: 0 !important;
        text-align: center !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .col-100.col-size .cart_btn .cr-btn-secondary {
        height: 36px !important;
        padding: 8px 18px !important;
        font-size: 12px !important;
        min-width: 120px !important;
        max-width: 160px !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.2px !important;
        transition: all 0.3s ease !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .col-100.col-size .cart_btn .cr-btn-secondary:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 15px rgba(244, 67, 54, 0.25) !important;
    }
    
    /* Limpiar cualquier float previo */
    .col-100.col-size .cr-product-box .cr-product-card::after,
    .col-100.col-size .cr-product-box::after {
        content: "" !important;
        display: table !important;
        clear: both !important;
    }
}

/* ===============================================
   DESKTOP OPTIMIZATION - LARGER SCREENS
   =============================================== */

@media (min-width: 992px) {
    /* Imagen más grande y prominente en desktop */
    .cr-product-image {
        height: 300px !important;
        min-height: 300px !important;
        border-radius: 12px !important;
        background: none !important;
        padding: 0 !important;
        margin-bottom: 16px !important;
        overflow: hidden !important;
    }
    
    .cr-product-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 12px !important;
        transition: transform 0.4s ease !important;
    }
    
    .cr-product-image:hover img {
        transform: scale(1.08) !important;
    }
    
    /* Card más alto para acomodar la imagen grande - SOLO GRILLA, NO LISTA */
    .cr-product-card:not(.col-100.col-size .cr-product-card) {
        padding: 14px !important;
        border-radius: 14px !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }
    
    /* Contenido más espaciado pero proporcionado - SOLO GRILLA, NO LISTA */
    .cr-product-details:not(.col-100.col-size .cr-product-details) {
        padding-top: 12px !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }
    
    /* Título más legible en desktop */
    .cr-product-details .title {
        font-size: 16px !important;
        line-height: 1.4 !important;
        margin-bottom: 12px !important;
        min-height: 44px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
    
    /* Precio más destacado */
    .cr-price {
        font-size: 18px !important;
        margin-bottom: 14px !important;
    }
    
    .cr-price .new-price {
        font-size: 18px !important;
        font-weight: 700 !important;
    }
    
    /* Botón más atractivo en desktop */
    .cart_btn .cr-btn-secondary {
        height: 44px !important;
        padding: 12px 24px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        border-radius: 10px !important;
        transition: all 0.3s ease !important;
    }
    
    .cart_btn .cr-btn-secondary:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3) !important;
    }
}

/* Para pantallas extra grandes */
@media (min-width: 1400px) {
    .cr-product-image {
        height: 320px !important;
        min-height: 320px !important;
    }
    
    .cr-product-details .title {
        font-size: 17px !important;
        min-height: 48px !important;
    }
    
    .cr-price {
        font-size: 19px !important;
    }
    
    .cr-price .new-price {
        font-size: 19px !important;
    }
    
    .cart_btn .cr-btn-secondary {
        height: 46px !important;
        font-size: 15px !important;
    }
}

/* ===============================================
   FORCE HORIZONTAL LAYOUT FOR LIST VIEW - MÁXIMA ESPECIFICIDAD
   =============================================== */

/* TEMPORALMENTE DESACTIVAMOS VISTA GRILLA - SOLO VISTA HORIZONTAL */
.col-100:not(.col-size) {
    /* Forzar vista de lista por defecto - temporalmente */
    display: none !important;
}

/* FORZAR SIEMPRE VISTA DE LISTA */
#products-container {
    /* Siempre usar clases de vista de lista */
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

/* REGLA GLOBAL: Vista de lista SIEMPRE horizontal sin importar el tamaño de pantalla */
.col-100.col-size .cr-product-box .cr-product-card,
.col-100.col-size .cr-product-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    width: 100% !important;
}

/* OVERRIDE cualquier regla que pueda hacer la lista vertical */
.col-100.col-size .cr-product-box .cr-product-card {
    flex-direction: row !important;
    align-items: center !important;
    padding: 12px !important;
    min-height: 120px !important;
}

/* Layout específico para lista horizontal - IMAGEN MÁS ANCHA Y ALTO COMPLETO */
.col-100.col-size .cr-product-image {
    width: 60% !important;
    margin-right: 16px !important;
    flex-shrink: 0 !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
}

.col-100.col-size .cr-product-details {
    width: 40% !important;
    flex: 1 !important;
    text-align: left !important;
    padding-left: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}
