/* =====================================================================
   ESTILOS DE PÁGINA DEL CARRITO
   Tabla de productos, controles y checkout
   ===================================================================== */

.cart-page {
    padding: 2rem;
}

.cart-page h1 {
    color: #1E3A8A;
    margin-bottom: 2rem;
    font-size: 2rem;
}

/* =====================================================================
   CARRITO VACÍO
   ===================================================================== */

.cart-empty {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #F9FAFB;
    border-radius: 12px;
}

.empty-cart-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.cart-empty h2 {
    color: #374151;
    margin-bottom: 1rem;
}

.cart-empty p {
    color: #6B7280;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* =====================================================================
   RESUMEN SUPERIOR
   ===================================================================== */

.cart-summary-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid #E5E7EB;
}

.cart-summary-top span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

/* =====================================================================
   TABLA DEL CARRITO
   ===================================================================== */

.cart-table-container {
    overflow-x: auto;
    margin-bottom: 2rem;
    display: block; /* Mostrar tabla en desktop */
}

/* Ocultar tarjetas móviles en desktop */
.cart-table-mobile {
    display: none;
}

.cart-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.cart-table thead {
    background-color: #F9FAFB;
    border-bottom: 2px solid #E5E7EB;
}

.cart-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cart-table td {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid #F3F4F6;
    vertical-align: middle;
}

.cart-table tbody tr:hover {
    background-color: #F9FAFB;
}

/* Columnas específicas */
.cart-table th:nth-child(1),
.cart-table td:nth-child(1) {
    width: 45%;
}

.cart-table th:nth-child(2),
.cart-table td:nth-child(2) {
    width: 15%;
}

.cart-table th:nth-child(3),
.cart-table td:nth-child(3) {
    width: 20%;
}

.cart-table th:nth-child(4),
.cart-table td:nth-child(4) {
    width: 15%;
}

.cart-table th:nth-child(5),
.cart-table td:nth-child(5) {
    width: 5%;
    text-align: center;
}

/* =====================================================================
   INFO DEL PRODUCTO EN CARRITO
   ===================================================================== */

.cart-product-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.product-image-small {
    width: 80px;
    height: 80px;
    background-color: #F3F4F6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.product-image-small img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-image-small span {
    font-size: 2rem;
}

.product-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-name {
    color: #1E3A8A;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s;
}

.product-name:hover {
    color: #1D4ED8;
    text-decoration: underline;
}

.product-sku {
    color: #6B7280;
    font-size: 0.85rem;
}

/* =====================================================================
   CONTROLES DE CANTIDAD
   ===================================================================== */

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: fit-content;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #D1D5DB;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.qty-btn:hover {
    border-color: #1E3A8A;
    background-color: #F3F4F6;
}

.qty-input {
    width: 60px;
    height: 32px;
    text-align: center;
    border: 2px solid #D1D5DB;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
}

.qty-input:focus {
    outline: none;
    border-color: #1E3A8A;
}

/* =====================================================================
   PRECIO Y ACCIONES
   ===================================================================== */

.cart-price {
    color: #374151;
    font-size: 1rem;
}

.cart-subtotal strong {
    color: #1E3A8A;
    font-size: 1.1rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* =====================================================================
   PIE DEL CARRITO
   ===================================================================== */

.cart-footer {
    display: block;
    margin-top: 3rem;
}

/* =====================================================================
   RESUMEN DE TOTALES
   ===================================================================== */

.cart-totals {
    background-color: #F9FAFB;
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid #E5E7EB;
    max-width: 500px;
    width: 100%;
    margin-left: auto;
    margin-right: 0;
}

.cart-totals h3 {
    color: #374151;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    color: #374151;
}

.totals-row span:first-child {
    text-align: left;
}

.totals-row strong,
.totals-row span:last-child {
    text-align: right;
}

.totals-separator {
    border-top: 2px solid #E5E7EB;
    margin: 1rem 0;
}

.totals-final {
    font-size: 1.3rem;
    padding: 1rem 0;
}

.totals-final .total-amount {
    color: #1E3A8A;
    font-size: 1.5rem;
}

.shipping-info {
    color: #6B7280;
    font-size: 0.9rem;
    font-style: italic;
}

.cart-totals .btn {
    width: 100%;
    margin-top: 1rem;
}

.btn-checkout {
    font-size: 1.1rem;
    padding: 1.2rem;
}

/* =====================================================================
   RESPONSIVE - CARRITO
   ===================================================================== */

@media (max-width: 992px) {
    .cart-totals {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    .cart-page {
        padding: 1rem;
    }

    .cart-page h1 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .cart-summary-top {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    /* Ocultar tabla en móviles y mostrar tarjetas */
    .cart-table-container {
        display: none;
    }

    .cart-table-mobile {
        display: block;
        margin-bottom: 2rem;
    }

    .cart-footer {
        gap: 1.5rem;
    }

    .cart-totals {
        padding: 1.5rem;
    }

    .cart-item-mobile {
        background: white;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .cart-item-mobile-header {
        display: flex;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .cart-item-mobile-image {
        width: 80px;
        height: 80px;
        background-color: #F3F4F6;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .cart-item-mobile-image img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .cart-item-mobile-info {
        flex: 1;
    }

    .cart-item-mobile-name {
        color: #1E3A8A;
        font-weight: 600;
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
        text-decoration: none;
        display: block;
    }

    .cart-item-mobile-sku {
        color: #6B7280;
        font-size: 0.85rem;
    }

    .cart-item-mobile-price {
        color: #374151;
        font-weight: 600;
        margin-top: 0.5rem;
    }

    .cart-item-mobile-actions {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid #E5E7EB;
    }

    .cart-item-mobile-quantity {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .cart-item-mobile-quantity span {
        font-size: 0.9rem;
        color: #374151;
        margin-right: 0.5rem;
    }

    .cart-item-mobile-subtotal {
        font-weight: 700;
        color: #1E3A8A;
        font-size: 1.1rem;
    }
}

@media (max-width: 640px) {
    .cart-page {
        padding: 0.75rem;
    }

    .cart-page h1 {
        font-size: 1.25rem;
    }

    .cart-item-mobile-header {
        flex-direction: column;
    }

    .cart-item-mobile-image {
        width: 100%;
        height: 200px;
    }

    .cart-item-mobile-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .cart-item-mobile-quantity {
        justify-content: center;
    }

    .cart-totals {
        padding: 1.25rem;
    }

}