﻿/* =============================================
   carrito.css — Vista Carrito de Compras
   EcommerceLuna
   ============================================= */

/* ── Encabezado ── */
.carrito-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.carrito-titulo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--luna-azul);
    margin-bottom: 0;
}

    .carrito-titulo i {
        color: var(--luna-rojo);
    }

.carrito-badge-total {
    background: rgba(26, 35, 126, .08);
    color: var(--luna-azul);
    border: 1px solid rgba(26, 35, 126, .15);
    border-radius: 50px;
    padding: .35rem 1rem;
    font-size: .82rem;
    font-weight: 600;
}

/* ── Card de items ── */
.carrito-items-card {
    overflow: hidden;
}

.carrito-items-lista {
    display: flex;
    flex-direction: column;
}

/* ── Fila de item ── */
.carrito-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, .07);
    transition: background .15s ease;
}

    .carrito-item:last-child {
        border-bottom: none;
    }

    .carrito-item:hover {
        background: rgba(26, 35, 126, .03);
    }

/* ── Ícono del producto ── */
.carrito-item-icono {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: rgba(26, 35, 126, .07);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--luna-azul);
}

/* ── Info del producto ── */
.carrito-item-info {
    flex: 1;
    min-width: 0;
}

.carrito-item-nombre {
    font-weight: 700;
    color: var(--luna-azul);
    margin-bottom: .15rem;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carrito-item-codigo {
    font-size: .78rem;
    color: #6c757d;
    margin-bottom: 0;
}

/* ── Precio unitario ── */
.carrito-item-precio {
    text-align: center;
    flex-shrink: 0;
}

.carrito-precio-unit {
    display: block;
    font-weight: 700;
    color: var(--luna-rojo);
    font-size: 1rem;
    white-space: nowrap;
}

.carrito-precio-label {
    font-size: .7rem;
    color: #adb5bd;
    text-transform: uppercase;
}

/* ── Control de cantidad ── */
.carrito-item-cantidad {
    flex-shrink: 0;
}

.cantidad-control {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    width: 110px;
}

.btn-cantidad {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 36px;
    cursor: pointer;
    font-size: .85rem;
    color: var(--luna-azul);
    transition: background .15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-cantidad:hover {
        background: rgba(26, 35, 126, .08);
    }

.cantidad-input {
    width: 46px;
    height: 36px;
    border: none;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
    text-align: center;
    font-size: .9rem;
    font-weight: 600;
    color: var(--luna-azul);
    outline: none;
    -moz-appearance: textfield;
}

    .cantidad-input::-webkit-inner-spin-button,
    .cantidad-input::-webkit-outer-spin-button {
        -webkit-appearance: none;
    }

/* ── Subtotal ── */
.carrito-item-subtotal {
    text-align: right;
    flex-shrink: 0;
    min-width: 90px;
}

.carrito-subtotal-valor {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--luna-azul);
    white-space: nowrap;
}

/* ── Botón eliminar ── */
.carrito-item-eliminar {
    flex-shrink: 0;
}

.btn-eliminar {
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #adb5bd;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-eliminar:hover {
        color: #dc3545;
        border-color: #dc3545;
        background: rgba(220, 53, 69, .07);
    }

/* ── Acciones inferiores ── */
.carrito-acciones {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}

/* ── Resumen del pedido ── */
.carrito-resumen {
    overflow: hidden;
}

.carrito-resumen-header {
    background: linear-gradient(135deg, var(--luna-azul) 0%, var(--luna-azul-light, #283593) 100%);
    color: #fff;
    padding: 1.1rem 1.5rem;
    font-weight: 600;
    font-size: 1.05rem;
}

.carrito-resumen-body {
    padding: 1.5rem;
}

.resumen-fila {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
    font-size: .95rem;
}

.resumen-label {
    color: #6c757d;
}

.resumen-valor {
    font-weight: 600;
    color: var(--luna-azul);
}

.resumen-divisor {
    border-top: 1px solid #e9ecef;
    margin: 1rem 0;
}

.resumen-total {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--luna-azul);
}

.resumen-total-valor {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--luna-rojo);
}

/* ── Botón finalizar ── */
.btn-finalizar {
    font-size: 1rem;
    padding: .7rem 1.25rem;
    border-radius: 8px;
}

/* ── Aviso login ── */
.carrito-login-aviso {
    background: rgba(26, 35, 126, .07);
    border-left: 3px solid var(--luna-azul);
    border-radius: 0 6px 6px 0;
    padding: .7rem 1rem;
    font-size: .85rem;
    color: var(--luna-azul);
}

/* ── Estado vacío ── */
.carrito-vacio {
    padding: 3rem 1rem;
}

.carrito-vacio-icono {
    font-size: 4rem;
    color: #dee2e6;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .carrito-item {
        flex-wrap: wrap;
        gap: .75rem;
        padding: 1rem;
    }

    .carrito-item-info {
        width: calc(100% - 64px);
    }

    .carrito-item-precio {
        order: 3;
    }

    .carrito-item-cantidad {
        order: 4;
    }

    .carrito-item-subtotal {
        order: 5;
        flex: 1;
    }

    .carrito-item-eliminar {
        order: 2;
    }

    .carrito-titulo {
        font-size: 1.5rem;
    }
}
