.contenedor {
    display: flex;
    padding: 20px;
    align-items: flex-start; /* Asegura que los elementos no se estiren */
}

.filtros {
    width: 250px;
    padding: 20px;
    border-right: 1px solid #ccc;
}

.categorias:hover, .subcategorias:hover {
    background-color: #f0f0f0;
}

.categoria-item, .subcategoria-item {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 5px 10px;
    border-radius: 5px;
}

.categoria-item:hover, .subcategoria-item:hover {
    background-color: #ddd;
}

.categorias, .subcategorias {
    display: block;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
}

.categorias {
    font-weight: bold;
    background-color: #f0f0f0;
    color: #333;
}

.subcategorias {
    margin-left: 20px;
    background-color: #e0e0e0;
    color: #555;
}

.filtros button {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 5px;
    background: #ddd;
    border: none;
    font-weight: bold;
    cursor: pointer;
}

.filtros .categoria-item {
    display: block;
    padding: 10px;
    color: black;
    text-decoration: none;
}

.contenido {
    display: flex;
    width: 100%;
    align-items: flex-start; /* Asegura que el carrito y los cursos queden alineados arriba */
}

.productos {
    display: flex;
    flex-wrap: wrap;
    flex: 1; /* Permite que los cursos ocupen el espacio restante */
    margin-left: 60px;
    gap: 20px;
    padding: 20px;
}

.producto {
    display: flex;
    flex-direction: column;
    width: 280px;
    height: 450px; /* Altura fija para mantener el tamaño uniforme */
    text-align: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.producto:hover {
    transform: scale(1.05);
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);
}

.imagen-contenedor {
    width: 100%;
    height: 200px; /* Altura fija para todas las imágenes */
    display: flex;
    justify-content: center;
    align-items: center;
}

.imagen-contenedor img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.producto h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 10px 0;
    min-height: 50px; /* Asegura que los títulos tengan el mismo espacio */
}

.producto p {
    font-size: 1rem;
    flex-grow: 1; /* Hace que el contenido crezca para mantener el alineamiento */
    margin: 5px 0;
}

.precio {
    font-weight: bold;
    color: #333;
    margin: 10px 0;
}

.agregar-carrito {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: hsl(320, 100%, 55%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    margin-top: 10px;
}

.agregar-carrito:hover {
    background-color: hsl(320, 80.2%, 47.5%);
}

/* Estilos mejorados para el carrito */
.carrito {
    width: 350px; /* Asegura un tamaño fijo para el carrito */
    min-width: 350px;
    padding: 15px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    border-radius: 8px;
    max-height: 700px;
    overflow-y: auto;
    position: sticky;
    top: 20px; /* Hace que el carrito se mantenga fijo mientras se desplaza */
}

.carrito ul {
    list-style: none;
    padding: 0;
}

.carrito li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
}

.carrito li img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 10px;
}

.carrito li .curso-info {
    flex-grow: 1;
}

.finalizar-compra {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: hsl(320, 100%, 55%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    margin-top: 10px;
}

.finalizar-compra:hover {
    background-color: hsl(320, 80.2%, 47.5%);
}

.carrito-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    gap: 10px;
    flex-wrap: nowrap;
}

.carrito-imagen {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
}

.carrito-info {
    flex-grow: 1;
    min-width: 0;
    padding-right: 10px;
    max-width: 200px; /* Ajusta según tu diseño */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.carrito-controles {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.carrito-controles form {
    display: flex;
    align-items: center;
    gap: 5px;
}

.carrito p {
    margin: 0;
    text-align: left;
    margin-top: 10px;
}

.boton-carrito {
    width: 30px;
    height: 30px;
    background-color: hsl(320, 80%, 55%);
    color: white;
    font-size: 16px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.boton-carrito:hover {
    background-color: hsl(320, 80.2%, 47.5%);
}

.boton-carrito:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.boton-eliminar {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

.boton-eliminar:hover {
    color: darkred;
}

.cantidad {
    width: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}

/* Responsividad */
@media (max-width: 768px) {
    .contenedor {
        flex-direction: column;
    }

    .filtros {
        width: 100%;
        margin-bottom: 20px;
    }

    .contenido {
        flex-direction: column;
    }

    .productos {
        width: 100%;
    }

    .producto {
        width: 100%;
    }

    .carrito {
        width: 100%;
        max-height: 300px; /* Reducir en móviles */
        position: relative; /* Evita que sea sticky en pantallas pequeñas */
    }
}