﻿/* Crear archivo: wwwroot/css/carrito.css */

/* =================================
   CARRITO FLOTANTE Y SIDEBAR
   ================================= */

:root {
    --carrito-primary: #1B4B8C;
    --carrito-success: #7CB342;
    --carrito-danger: #EF4444;
    --carrito-warning: #F59E0B;
    --carrito-dark: #2C2C2C;
    --carrito-light: #F8F9FA;
    --carrito-white: #FFFFFF;
}

/* Carrito flotante */
.carrito-flotante {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.btn-carrito {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--carrito-primary) 0%, var(--carrito-success) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(27, 75, 140, 0.3);
}

    .btn-carrito:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 30px rgba(27, 75, 140, 0.4);
    }

.carrito-contador {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--carrito-danger);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

    .carrito-contador.show {
        transform: scale(1);
    }

.carrito-total-info {
    background: var(--carrito-white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.carrito-flotante:hover .carrito-total-info {
    transform: translateY(0);
    opacity: 1;
}

.carrito-total {
    font-weight: 700;
    color: var(--carrito-primary);
    font-size: 0.875rem;
}

/* Overlay */
.carrito-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

    .carrito-overlay.show {
        opacity: 1;
        visibility: visible;
    }

/* Sidebar del carrito */
.carrito-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: var(--carrito-white);
    z-index: 1070;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
}

    .carrito-sidebar.show {
        transform: translateX(0);
    }

.carrito-header {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--carrito-light);
}

    .carrito-header h4 {
        margin: 0;
        color: var(--carrito-primary);
        font-weight: 700;
    }

.btn-cerrar {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--carrito-dark);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-cerrar:hover {
        background: rgba(239, 68, 68, 0.1);
        color: var(--carrito-danger);
    }

.carrito-contenido {
    flex: 1;
    overflow-y: auto;
}

.carrito-items {
    padding: 1rem;
}

/* Items del carrito */
.carrito-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

    .carrito-item:hover {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

.item-imagen {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

    .item-imagen img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 8px;
    }

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-nombre {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--carrito-dark);
    margin: 0;
    line-height: 1.3;
}

.item-precio {
    font-weight: 700;
    color: var(--carrito-primary);
    font-size: 0.875rem;
}

.item-controles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-cantidad {
    background: var(--carrito-light);
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    color: var(--carrito-dark);
}

    .btn-cantidad:hover {
        background: var(--carrito-primary);
        border-color: var(--carrito-primary);
        color: white;
    }

.cantidad-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.btn-eliminar {
    background: none;
    border: none;
    color: var(--carrito-danger);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: auto;
}

    .btn-eliminar:hover {
        background: rgba(239, 68, 68, 0.1);
    }

/* Footer del carrito */
.carrito-footer {
    padding: 1.5rem;
    border-top: 1px solid #E5E7EB;
    background: var(--carrito-light);
}

.carrito-resumen {
    background: var(--carrito-white);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
}

/* Estado vacío */
.carrito-vacio {
    padding: 2rem 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .carrito-sidebar {
        width: 100%;
        max-width: 400px;
    }

    .carrito-flotante {
        bottom: 1rem;
        right: 1rem;
    }

    .btn-carrito {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .carrito-contador {
        width: 20px;
        height: 20px;
        font-size: 0.6875rem;
        top: -6px;
        right: -6px;
    }
}

/* Animaciones */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.carrito-contador.animate {
    animation: bounce 0.6s ease;
}

/* Estados de carga */
.carrito-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--carrito-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}
