/* ==========================================================================
   Sección: Productos Más Nuevos (WooCommerce Loop) - ACTUALIZADO
   ========================================================================== */
.newest-section {
    padding-bottom: 56px;
    background-color: #f6f6f6; /* Fondo general gris */
    width: 100%;
}

.newest-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 50px;
}

/* Encabezado */
.newest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.newest-title {
    font-size: 2.1rem;
    font-weight: 600;
    color: #111;
    margin: 0;
}

.newest-title .highlight {
    color: #00A803;
}

.btn-outline-catalog {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 30px;
    color: #555;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    background-color: #fff;
    transition: all 0.3s ease;
}

.btn-outline-catalog:hover {
    background-color: #f0f0f0;
    color: #111;
}

/* Contenedor del Slider y Flechas */
.slider-wrapper {
    position: relative;
    margin: 0 -20px; /* Expande el wrapper para que las flechas quepan fuera de las tarjetas */
    padding: 0 20px;
}

.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.slider-arrow i { font-size: 24px; width: 24px; height: 24px; }
.slider-arrow:hover { color: #111; }
.arrow-prev { left: -15px; }
.arrow-next { right: -15px; }

/* El Slider (La pista) */
.newest-slider {
    display: flex;
    gap: 20px;
    padding-bottom: 20px;
    
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.newest-slider.active {
    cursor: grabbing;
    scroll-snap-type: none;
}

.newest-slider::-webkit-scrollbar { display: none; }

/* Tarjeta de Producto */
.product-card {
    flex: 0 0 calc(20% - 16px); /* 5 tarjetas en desktop (ajusta el 20% si quieres más/menos) */
    max-width: 229px;
    display: flex;
    flex-direction: column;
    background: transparent; /* Fondo transparente */
    scroll-snap-align: start;
    user-select: none;
    -webkit-user-drag: none;
    user-drag: none;
}

/* Imagen y Etiquetas (El recuadro blanco) */
.product-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* Cuadrado perfecto */
    background-color: #ffffff; /* Recuadro blanco */
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.product-img-link { display: block; width: 100%; height: 100%; }
.product-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

/* Badges */
/* Badges (Etiquetas en Desktop) */
.product-badges {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px; /* ¡CLAVE 1! Le pone un límite a la derecha para que no se salga de la imagen */
    display: flex;
    flex-wrap: wrap; /* ¡CLAVE 2! Le permite a las etiquetas saltar a la siguiente línea si no caben */
    gap: 6px;
    z-index: 2;
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
}

.badge i { font-size: 12px; width: 12px; height: 12px; margin-right: 4px; }
.badge-nuevo { background-color: #d32f2f; } /* Rojo oscuro para Nuevo según tu diseño */
.badge-darc { background-color: #333; } /* Gris oscuro para DARC */
.badge-personalizable { background: linear-gradient(to right, #B437DE, #78AEFF); }

/* Contenido de la Tarjeta */
.product-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-meta {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-separator { color: #ccc; }

.product-title {
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.4;
    margin: 0 0 0px 0;
}

.product-title a { color: #222; text-decoration: none; }
.product-title a:hover { color: #00b912; }

/* Botones Inferiores */
.product-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.product-card a,
.product-img {
    -webkit-user-drag: none;
    user-drag: none;
}

.btn-add-quote {
    flex: 1;
    background-color: #00b912;
    color: #ffffff;
    text-align: center;
    padding: 10px 15px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}


.btn-add-quote:hover { background-color: #009d0f; color: #fff; }



/* Barra de Progreso Inferior */
.slider-scrollbar {
    margin-top: 20px;
    width: 100%;
}

.scrollbar-track {
    width: 100%;
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.scrollbar-thumb {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: #00b912;
    border-radius: 2px;
    width: 20%; /* El JS actualizará esto */
    transition: left 0.1s ease;
}

/* Responsive Mobile */
/* ==========================================================================
   Responsive (Mobile) - ACTUALIZADO
   ========================================================================== */
@media screen and (max-width: 991px) {
    .newest-section {
        padding: 40px 0;
    }

    .newest-container {
        padding: 0 20px; /* Aquí aseguramos exactamente los 20px a los lados */
    }

    .newest-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .slider-arrow { 
        display: none; /* Ocultar flechas en móvil */
    } 
    
    .slider-wrapper {
        margin: 0; /* Quitamos los márgenes negativos de desktop */
        padding: 0;
    }

    .newest-slider {
        gap: 15px; /* Espacio de 15px entre tarjetas */
    }

    /* --- La Tarjeta en Móvil --- */
    .product-card {
        /* Hacemos que la tarjeta mida la mitad del contenedor (50%) menos la mitad del gap (7.5px) */
        flex: 0 0 calc(50% - 7.5px); 
        min-width: 0; /* ¡CLAVE! Quitamos la restricción de 240px de desktop para que puedan encogerse */
    }

    /* Ajustes para que el contenido quepa bien en las tarjetas al ser más pequeñas */
    .product-image-wrapper {
        height: 160px; /* Hacemos la caja de la imagen un poco más bajita */
        padding: 10px;
    }

    .product-title {
        font-size: 13px; /* Letra un poco más pequeña */
        margin-bottom: 10px;
    }

    .product-actions {
        gap: 5px; /* Acercamos el botón de carrito y el de favoritos */
    }

    .btn-add-quote {
        padding: 8px 5px; /* Reducimos el padding lateral para ganar espacio */
        font-size: 10.5px; /* Letra un puntito más pequeña */
        white-space: nowrap; /* ¡LA CLAVE! Obliga al texto a quedarse en una sola línea */
        gap: 4px; /* Acercamos el icono al texto */
        overflow: hidden; /* Previene desbordamientos en pantallas ultra pequeñas */
        text-overflow: ellipsis; /* Pone "..." si la pantalla es ridículamente estrecha */
    }

    /* También podemos hacer el icono un poquito más pequeño para ganar milímetros */
    .btn-add-quote i {
        font-size: 13px;
        width: 13px;
        height: 13px;
    }

    .btn-wishlist {
        width: 32px; /* Botón de favoritos un poco más pequeño */
        height: 32px;
    }

    .btn-wishlist i {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }
}