/* ==========================================
   GATEWAY IT - CART.CSS
   Estilos del carrito de compras
   ========================================== */

:root {
    --cart-width: 420px;
    --cart-width-mobile: 90vw;
}

/* ==========================================
   OVERLAY (BACKDROP)
   ========================================== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   SIDEBAR PRINCIPAL
   ========================================== */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--cart-width);
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

body.dark-mode .cart-sidebar {
    background: #1a1a2e;
}

.cart-sidebar.active {
    transform: translateX(0);
}

/* ==========================================
   HEADER DEL CARRITO
   ========================================== */
.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #F58635 0%, #ff9d5c 100%);
    color: white;
}

.cart-sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-sidebar-header h2 i {
    font-size: 1.3rem;
}

.cart-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
}

.cart-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ==========================================
   BODY DEL CARRITO
   ========================================== */
.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #ffffff;
}

body.dark-mode .cart-sidebar-body {
    background: #1a1a2e;
}

/* Scrollbar personalizado */
.cart-sidebar-body::-webkit-scrollbar {
    width: 8px;
}

.cart-sidebar-body::-webkit-scrollbar-track {
    background: rgba(128, 128, 128, 0.1);
}

.cart-sidebar-body::-webkit-scrollbar-thumb {
    background: #F58635;
    border-radius: 4px;
}

.cart-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: #d97530;
}

/* ==========================================
   CARRITO VACÍO
   ========================================== */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    height: 100%;
}

.cart-empty i {
    font-size: 5rem;
    color: #e0e0e0;
    margin-bottom: 1.5rem;
}

.cart-empty p {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
}

body.dark-mode .cart-empty p {
    color: #a0a0c0;
}

/* ==========================================
   LISTA DE ITEMS
   ========================================== */
.cart-items-list {
    display: none; /* Oculto por defecto hasta que haya items */
}

/* ==========================================
   ITEM DEL CARRITO
   ========================================== */
.cart-item {
    display: grid;
    grid-template-columns: 50px 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: rgba(128, 128, 128, 0.05);
    border: 1px solid rgba(128, 128, 128, 0.15);
    border-radius: 10px;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.cart-item:hover {
    background: rgba(245, 134, 53, 0.08);
    border-color: rgba(245, 134, 53, 0.3);
    box-shadow: 0 2px 8px rgba(245, 134, 53, 0.15);
}

.cart-item-icon,
.cart-item-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #F58635 0%, #ff9d5c 100%);
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-details {
    display: flex;
    flex-direction: column;
}

.cart-item-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 0.25rem 0;
}

body.dark-mode .cart-item-details h4 {
    color: #ffffff;
}

.cart-item-price {
    font-size: 0.9rem;
    color: #F58635;
    font-weight: 700;
    margin: 0;
}

/* ==========================================
   CONTROLES DE CANTIDAD
   ========================================== */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(128, 128, 128, 0.2);
}

body.dark-mode .cart-item-quantity {
    background: #0f0f1e;
    border-color: rgba(255, 255, 255, 0.1);
}

.cart-item-quantity span {
    font-weight: 600;
    color: #1a1a2e;
    min-width: 24px;
    text-align: center;
}

body.dark-mode .cart-item-quantity span {
    color: #ffffff;
}

.qty-btn {
    background: #F58635;
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.qty-btn:hover {
    background: #d97530;
    transform: scale(1.1);
}

.qty-btn:active {
    transform: scale(0.95);
}

/* ==========================================
   BOTÓN ELIMINAR
   ========================================== */
.cart-item-remove {
    background: #ef4444;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cart-item-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.cart-item-remove:active {
    transform: scale(0.95);
}

/* ==========================================
   FOOTER DEL CARRITO
   ========================================== */
.cart-sidebar-footer {
    padding: 1.5rem;
    border-top: 2px solid rgba(128, 128, 128, 0.2);
    background: #f8f9fa;
}

body.dark-mode .cart-sidebar-footer {
    background: #0f0f1e;
    border-top-color: rgba(255, 255, 255, 0.1);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.cart-total span:first-child {
    font-weight: 600;
    color: #1a1a2e;
}

body.dark-mode .cart-total span:first-child {
    color: #ffffff;
}

.cart-total-amount {
    font-weight: 800;
    color: #F58635;
    font-size: 1.5rem;
}

/* ==========================================
   BOTONES
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    /* border: none; */
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(135deg, #F58635 0%, #ff9d5c 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #d97530 0%, #ff8c47 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 134, 53, 0.3);
}

.btn-block {
    width: 100%;
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */
@media (max-width: 768px) {
    .cart-sidebar {
        width: var(--cart-width-mobile);
        max-width: 400px;
    }

    .cart-sidebar-header h2 {
        font-size: 1.3rem;
    }

    .cart-item {
        grid-template-columns: 45px 1fr auto;
        gap: 0.75rem;
        padding: 0.875rem;
    }

    .cart-item-icon,
    .cart-item-image {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .cart-item-details h4 {
        font-size: 0.9rem;
    }

    .cart-item-remove {
        grid-column: 3;
        grid-row: 1;
    }

    .cart-item-quantity {
        grid-column: 2 / 4;
        grid-row: 2;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    .cart-total {
        font-size: 1.1rem;
    }

    .cart-total-amount {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .cart-sidebar {
        width: 100vw;
        max-width: 100%;
    }

    .cart-sidebar-header {
        padding: 1.25rem 1rem 0.875rem;
    }

    .cart-sidebar-body {
        padding: 0.75rem;
    }

    .cart-sidebar-footer {
        padding: 1rem;
    }
}
