/* ==========================================================================
   PAGE LAYOUT & STICKY FOOTER
   ========================================================================== */
body {
    /* Convierte el body en un contenedor flex vertical */
    display: flex;
    flex-direction: column;
    /* Asegura que ocupe al menos toda la altura de la ventana gráfica */
    min-height: 100vh;
}

.cart-container {
    /* Permite que esta sección principal crezca para ocupar el espacio disponible */
    flex-grow: 1;
}

/* ==========================================================================
   CART STYLES
   ========================================================================== */

/* Contenedor principal del carrito */
.cart-container {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Encabezado del carrito */
.cart-header {
    display: grid;
    grid-template-columns: 40% 30% 30%;
    width: 100%;
    justify-items: start;
    margin: 1rem 0;
}

.cart-header h6 {
    color: #121212bf;
    font-weight: 300;
}

.cart-header h6:last-child {
    justify-self: end;
    align-self: end;
}

/* Elemento del carrito */
.cart-item {
    display: grid;
    grid-template-columns: 40% 30% 30%;
    width: 100%;
    align-items: center;
    justify-items: start;
    margin-bottom: 16px;
}

.cart-item .item-total {
    justify-self: end;
}

/* Detalles del producto */
.product-details {
    display: flex;
    height: 120px;
    align-items: center;
    font-size: 14px;
}

.product-info {
    display: flex;
    flex-direction: column;
    margin-left: 24px;
    width: 100%;
}

.product-info h5 {
    font-weight: 500; /* Bold */
}

.product-details img {
    height: 70%;
    border-radius: 12.5%;
}

/* Control de cantidad */
.quantity-control {
    display: flex;
    align-items: center;
    width: 80%;
}

.quantity-input {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    border: 1px solid black;
    min-height: 3rem;
    border-radius: 4px;
    width: 100%;
    max-width: 128px;
}

.quantity-input input[type="number"] {
    width: 40%;
    text-align: center;
    border: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.quantity-input input[type="number"]::-webkit-inner-spin-button,
.quantity-input input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-btn {
    cursor: pointer;
    font-size: 1rem;
    border: none;
    background-color: transparent;
}

.quantity-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.remove-btn {
    border: none;
    background-color: transparent;
    cursor: pointer;
    margin-left: 24px;
}
.remove-btn:hover {
    opacity: 0.7;
}


/* Resumen del carrito */
.cart-summary {
    align-self: flex-end;
    width: 30%;
    display: flex;
    flex-direction: column;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.summary-total p {
    color: #121212;
    font-weight: 500; /* Bold */
}
.summary-total h4 {
    color: #121212bf;
    font-weight: 300;
}

.cart-summary h6 {
    margin: 12px 0;
    font-size: 13px;
}

.checkout-form {
    margin-top: 15px;
}

.checkout-form .btn {
    width: 100%;
}

/* Estilos de mensajes flash y otros */
.flash-message { padding: 15px; text-align: left; }
.flash-success { color: #25925F; }
.flash-error { color: #721c24; }

.btn:disabled { 
    background-color: #ccc !important;
    border-color: #ccc !important; 
    cursor: not-allowed; 
}

.custom-product-details {
    display: block; 
    color: #555; 
    font-size: 0.9em; 
    margin-top: 5px;
}
.custom-product-details div { 
    line-height: 1.4; 
}

.empty-cart {
    text-align: center; 
    padding: 40px 20px; 
    min-height: 200px; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}

/* Responsive */
@media screen and (max-width: 1200px) {
    .cart-header {
        grid-template-columns: 60% 40%;
    }

    .cart-header h6:nth-child(2) {
        display: none;
    }

    .cart-item {
        grid-template-columns: 60% 40%;
        grid-template-rows: auto auto;
        justify-items: start;
        border-bottom: 1px solid var(--color-gray-light);
        padding-bottom: 1rem;
    }

    .product-details {
        grid-column: 1 / 3;
    }

    .quantity-control {
        grid-column: 1 / 2;
        grid-row: 2;
        justify-content: flex-start;
        max-width: none;
        padding-top: 1rem;
    }

    .item-total {
        grid-column: 2 / 3;
        grid-row: 2;
        align-self: center;
        justify-self: end;
        padding-top: 1rem;
    }

    .cart-summary {
        width: 100%;
        margin-top: 24px;
        margin-bottom: 24px;
    }

    .checkout-form .btn {
        width: 100%;
        max-width: none;
    }
}