/* ==========================================================================
   Cesta de Compras - Estilos Rediseñados
   ========================================================================== */

/* Contenedor Principal
-------------------------------------------------------------------------- */
.cesta-container {
    display: flex;
    flex-wrap: wrap; /* Permite que el resumen se mueva debajo en pantallas pequeñas */
    justify-content: space-between;
    padding: 2rem 4%; /* Usar % para padding lateral adaptable */
    max-width: 1400px;
    margin: 2rem auto;
    gap: 2.5rem; /* Aumentar el espacio entre la lista y el resumen */
}

/* Columna de Artículos
-------------------------------------------------------------------------- */
#cesta-con-items {
    flex: 1 1 60%; /* Ocupa más espacio y es flexible */
    min-width: 320px; /* Ancho mínimo para evitar que se comprima demasiado */
}

#cesta-con-items h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 1rem;
}

/* Estilo para cada artículo en la cesta
-------------------------------------------------------------------------- */
.cesta-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease;
}

.cesta-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cesta-item:last-child {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0;
}

.cesta-item img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
    background-color: #f5f5f5;
}

.cesta-item-link {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    gap: 1.5rem;
    flex-grow: 1;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.item-marca {
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.item-nombre {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 4px 0;
    line-height: 1.4;
}

.item-color {
    font-size: 0.9em;
    color: #555;
    margin: 5px 0;
    padding: 4px 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.item-talla {
    font-size: 0.9em;
    color: #555;
    margin: 5px 0;
    padding: 4px 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.item-precio {
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
    margin-top: 8px;
}

.item-precio-total {
    font-size: 1.1rem;
    font-weight: bold;
    color: #d9534f;
    margin-top: 8px;
}

/* Controles de Cantidad y Eliminación
-------------------------------------------------------------------------- */
.item-controles {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    margin-left: auto; /* Empuja los controles a la derecha */
}

.item-cantidad {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    margin-right: 1rem;
}

.btn-cantidad {
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    color: #555;
    transition: background-color 0.2s;
}

.btn-cantidad:hover {
    background-color: #e0e0e0;
}

.item-quantity-input {
    width: 45px;
    text-align: center;
    border: none;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.item-quantity-input:focus {
    outline: none;
}

/* Ocultar flechas (spinners) en input de número */
.item-quantity-input::-webkit-outer-spin-button,
.item-quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.btn-eliminar {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s;
    align-self: flex-start;
    margin-top: 0.5rem;
}

.btn-eliminar:hover {
    color: #fff;
    background-color: #dc3545;
    text-decoration: none;
}


/* Resumen del Pedido
-------------------------------------------------------------------------- */
.resumen-pedido {
    flex: 1 1 35%; /* Ocupa menos espacio y es flexible */
    min-width: 300px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 12px; /* Bordes más pronunciados */
    padding: 2rem;
    height: fit-content; /* Se ajusta a su contenido */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* Sombra sutil */
    position: sticky; /* Se mantiene visible al hacer scroll */
    top: 2rem;
}

.resumen-pedido h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.resumen-linea {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: #555;
    margin-bottom: 1rem;
}

.resumen-linea span:last-child {
    font-weight: 500;
    color: #333;
}

.descuento-linea span:last-child {
    color: #28a745; /* Color verde para el descuento */
}

.resumen-pedido hr {
    border: 0;
    border-top: 1px solid #e0e0e0;
    margin: 1.5rem 0;
}

.total-pedido {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: bold;
    color: #000;
    margin-bottom: 2rem;
}

.boton-pagar {
    width: 100%;
    padding: 1rem;
    background-color: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.boton-pagar:hover:not(:disabled) {
    background-color: #000;
    color: #fff; /* Asegurar que el texto permanezca blanco */
    transform: translateY(-2px);
}

.boton-pagar:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    color: #888;
}

/* Cesta Vacía
-------------------------------------------------------------------------- */
#cesta-vacia {
    width: 100%;
    text-align: center;
}

.cesta-vacia-contenido {
    padding: 4rem 2rem;
    background-color: #f9f9f9;
    border: 2px dashed #ddd;
    border-radius: 12px;
}

.icono-cesta-vacia {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.cesta-vacia-contenido p {
    font-size: 1.3rem;
    color: #666;
    margin: 1rem 0 2rem 0;
}

.boton-comprar {
    background-color: #000;
    color: #fff;
    padding: 0.8rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.boton-comprar:hover {
    background-color: #333;
}

/* Media Queries para Responsividad
-------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .cesta-container {
        flex-direction: column;
        padding: 1.5rem 3%;
    }
    .resumen-pedido {
        width: 100%;
        position: static; /* Quitar sticky en móvil */
        margin-top: 2rem;
    }

    #cesta-con-items {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .cesta-container {
        padding: 1rem 2%;
        gap: 1.5rem;
    }

    .cesta-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }

    .cesta-item img {
        width: 100%;
        height: auto;
        max-width: 200px;
        margin: 0 auto;
    }

    .cesta-item-link {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }

    .item-info {
        text-align: center;
        width: 100%;
    }

    .item-controles {
        margin-top: 1rem;
        flex-direction: row;
        justify-content: center;
        width: 100%;
        align-items: center;
    }

    .item-cantidad {
        margin-right: 0;
    }

    .resumen-pedido {
        padding: 1.5rem;
    }

    .resumen-pedido h3 {
        font-size: 1.3rem;
    }

    .total-pedido {
        font-size: 1.2rem;
    }

    .boton-pagar {
        padding: 0.9rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .cesta-container {
        padding: 1rem 1%;
        gap: 1rem;
    }

    .cesta-item {
        padding: 0.8rem;
    }

    .cesta-item img {
        max-width: 150px;
    }

    .item-nombre {
        font-size: 1rem;
    }

    .item-precio {
        font-size: 0.9rem;
    }

    .item-precio-total {
        font-size: 1rem;
    }

    .resumen-pedido {
        padding: 1rem;
    }

    .resumen-pedido h3 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .resumen-linea {
        font-size: 0.9rem;
    }

    .total-pedido {
        font-size: 1.1rem;
    }

    .boton-pagar {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    #cesta-vacia h2 {
        font-size: 1.5rem;
    }

    .cesta-vacia-contenido {
        padding: 3rem 1rem;
    }

    .icono-cesta-vacia {
        font-size: 3rem;
    }

    .cesta-vacia-contenido p {
        font-size: 1.1rem;
    }
}
