/* Contenedor filtros */
.filters-container {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Filtros desplegables */
.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
}

#toggle-filters {
  display: inline-block;
  transition: transform 0.3s ease;
  cursor: pointer;
}

/* Cuando el icono tiene la clase 'rotated' lo gira 180 grados */
#toggle-filters.rotated {
  transform: rotate(180deg);
}

.filtrosdesplegables {
    display: none;
    transition: all 0.3s ease;
}

.filtrosdesplegables.show {
  display: block;
}

.arrow {
    transition: transform 0.3s ease, color 0.3s ease;
    font-size: 1.5rem;
    margin-left: 5px;
}


.filters-header h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.filter-sort,
.filter-categories,
.filter-attributes {
    margin-bottom: 15px;
}

.filter-sort {
    margin-top: 10px;
}

.filter-price {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f4f4f4;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.filter-price label {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}

.dual-range-slider {
    position: relative;
    width: 100%;
    height: 40px;
}

.dual-range-slider input[type="range"] {
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    pointer-events: none;
    -webkit-appearance: none;
    background: none;
    z-index: 2;
}

.dual-range-slider input[type="range"]::-webkit-slider-thumb {
    pointer-events: all;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.dual-range-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    background: #007bff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.slider-track {
    position: absolute;
    top: 18px;
    left: 0;
    height: 5px;
    width: 100%;
    background: #ddd;
    z-index: 1;
    border-radius: 5px;
    overflow: hidden;
}

.slider-track::before {
    content: '';
    position: absolute;
    height: 100%;
    background-color: #007bff;
    left: 0%;
    right: 0%;
    z-index: 2;
}

.price-output {
    font-size: 16px;
    color: #333;
    margin-top: 10px;
    text-align: center;
}


.filter-sort select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.filter-categories ul,
.filter-attributes ul {
    list-style: none;
    padding: 0;
}

.filter-categories li,
.filter-attributes li {
    margin-bottom: 8px;
}

.filter-categories input[type="checkbox"],
.filter-attributes input[type="checkbox"] {
    margin-right: 10px;
}

.apply-filters-btn {
    width: 100%;
    background-color: #007bff;
    color: white;
    padding: 10px;
    font-size: 1.1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.apply-filters-btn:hover {
    background-color: #0056b3;
}

/* Productos */
.product-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    position: relative;
}

.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.image-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #4caf50;
    color: white;
    font-size: 0.9em;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.product-image {
    width: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
}

.product-info h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.product-info h3 a {
    color: #000;
    text-decoration: none;
}

.product-info h3 a:hover {
    text-decoration: underline;
}

.product-info .price {
    font-size: 24px;
    color: #333;
    display: flex;
    flex-direction: column;
}

.product-info .current-price {
    font-weight: bold;
    color: #4caf50;
    font-size: 1.2em;
    margin-top: -10px;
}

.product-info .original-price {
    color: red;
    text-decoration: line-through;
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 0;
    display: block;
}

.product-info .discounted-price {
    font-weight: bold;
    color: #4caf50;
    font-size: 1.2em;
    margin-top: -30px;
    display: block;
}

/* Bot贸n agregar al carrito */
.add-to-cot-btn {
    background-color: #e63946;
    color: #fff;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    margin-top: 15px;
    margin-left: auto;
    margin-right: auto;
    min-width: 170px;
    height: 40px;
}

.out-of-stock-badge {
    background-color: #e63946;
    color: #fff;
    font-weight: bold;
    text-align: center;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    padding: 6px 0;
    z-index: 2;
    font-size: 14px;
    border-radius: 4px 4px 0 0;
}

.add-to-cot-btn:hover {
    background-color: #d62828;
}

.add-to-cot-btn .button-content {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.5s ease-out;
}

.add-to-cot-btn.moving .button-content {
    transform: translateX(150%);
}

.add-to-cot-btn.moving i.fas.fa-shopping-bag {
    display: none;
}

.add-to-cot-btn .finger {
    display: none;
    font-size: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0;
}

.add-to-cot-btn.moving .finger {
    display: inline-block;
    animation: finger 0.5s forwards;
}

.disabled-btn {
    opacity: 0.5;
    pointer-events: none; /* Impide click */
    filter: grayscale(100%);
    cursor: not-allowed;
}

@keyframes finger {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Responsividad productos */
@media (max-width: 768px) {
    .product-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-card {
        margin-bottom: 20px;
    }

    .add-to-cot-btn {
        font-size: 14px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .product-cards {
        grid-template-columns: 1fr;
    }
}

/* Etiqueta sin stock */
.sin-stock-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 5px 0;
    z-index: 10;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
}
