﻿/* =========================================
   PANEL DEL CARRITO
   ========================================= */

#cartPanel {
    position: fixed;
    background-color: #fff;
    z-index: 2000;
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.32s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Desktop: sidebar derecha */
@media (min-width: 769px) {
    #cartPanel {
        top: 0;
        right: 0;
        bottom: 0;
        width: 390px;
        height: 100vh;
        transform: translateX(100%);
    }
    #cartPanel.active {
        transform: translateX(0);
    }
}

/* Mobile: bottom sheet */
@media (max-width: 768px) {
    #cartPanel {
        left: 0;
        bottom: 0;
        width: 100%;
        height: 88vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    }
    #cartPanel.active {
        transform: translateY(0);
    }
}

/* =========================================
   HEADER
   ========================================= */

.cart-header {
    flex-shrink: 0;
    padding: 16px 20px;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

@media (max-width: 768px) {
    .cart-header { border-radius: 20px 20px 0 0; }
}

/* =========================================
   BARRA DE PROGRESO DE CUOTAS
   Mismo lenguaje visual que .checkout-stepper (checkout.css):
   nodo circular + línea conectora, adaptado a panel claro.
   ========================================= */

.cart-progress {
    flex-shrink: 0;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-progress-stepper {
    display: flex;
    align-items: center;
}

.cp-line {
    flex: 1;
    height: 3px;
    min-width: 20px;
    background: #ececec;
    border-radius: 3px;
    overflow: hidden;
}

.cp-line-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--acento, #feb422);
    border-radius: 3px;
    transition: width 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.cp-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 0 10px;
}

.cp-node-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e2e2e2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: transparent;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.cp-node-label {
    font-size: 0.64rem;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.cp-node.reached .cp-node-circle {
    background: #2ecc71;
    border-color: #2ecc71;
    color: #fff;
}
.cp-node.reached .cp-node-label { color: #16a34a; }

.cart-progress-text {
    margin: 10px 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-align: center;
}
.cart-progress-text strong { color: #111; }
.cart-progress-text.reached { color: #16a34a; }
.cart-progress-text i { margin-right: 5px; }

/* Efecto al alcanzar un checkpoint (3 o 6 cuotas): pulso en el nodo correspondiente */
@keyframes cpNodePulse {
    0%   { box-shadow: 0 0 0 0 rgba(46,204,113,0.45); }
    70%  { box-shadow: 0 0 0 10px rgba(46,204,113,0); }
    100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}
.cp-node.milestone-pop .cp-node-circle {
    animation: cpNodePulse 0.7s ease-out;
}

.cart-milestone-toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translate(-50%, -12px);
    background: #111;
    color: #feb422;
    padding: 12px 22px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0,0,0,0.28);
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
.cart-milestone-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cart-milestone-toast i { margin-right: 6px; }

/* =========================================
   ITEMS
   ========================================= */

#cartItems {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 transparent;
}

/* =========================================
   ESTADO VACÍO
   ========================================= */

.cart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    gap: 10px;
}

.cart-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.cart-empty-icon i {
    font-size: 2rem;
    color: #ccc;
}

.cart-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.cart-empty-sub {
    font-size: 0.82rem;
    color: #aaa;
    margin: 0;
    line-height: 1.5;
    max-width: 200px;
}

.cart-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    padding: 9px 20px;
    background: #000;
    color: #feb422;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    letter-spacing: 0.03em;
}

.cart-empty-cta:hover {
    background: #feb422;
    color: #000;
}

/* =========================================
   FOOTER: TOTALES Y BOTONES
   ========================================= */

#cartFooter {
    flex-shrink: 0;
    background: #fff;
    padding: 14px 18px 24px;
    border-top: 1px solid #f0f0f0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    color: #888;
    padding: 4px 0;
}

.summary-row.discount-row {
    color: #16a34a;
    font-size: 0.82rem;
    font-weight: 600;
}

.summary-row.discount-row i {
    font-size: 0.75rem;
    margin-right: 2px;
}

.summary-row.total {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1.5px solid #f0f0f0;
}

.summary-row.transfer-row {
    font-size: 0.82rem;
    color: #888;
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 6px;
}
.summary-row.transfer-row i { margin-right: 5px; color: #aaa; }
.summary-row.transfer-row .transfer-badge {
    background: rgba(46,204,113,0.14);
    color: #16a34a;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}
.summary-row.transfer-row.has-discount {
    color: #16a34a;
    font-weight: 700;
    background: rgba(46,204,113,0.07);
}
.summary-row.transfer-row.has-discount i { color: #16a34a; }

/* Contenedor de los botones de checkout */
.cart-checkout-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

/* Base compartida */
.checkout-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 12px 8px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1;
}

.checkout-btn i {
    font-size: 1.15rem;
}

/* Pedido Web — CTA principal, dorado */
.checkout-btn-web {
    background: #feb422 !important;
    color: #000 !important;
    border: none !important;
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.3);
}

.checkout-btn-web:hover {
    background: #c9a42e !important;
    box-shadow: 0 5px 16px rgba(212, 175, 55, 0.45);
    transform: translateY(-1px);
}

/* Mostrador — secundario, oscuro */
.checkout-btn-local {
    background: #1a1a1a !important;
    color: #ccc !important;
    border: 1px solid #2e2e2e !important;
}

.checkout-btn-local:hover {
    background: #2a2a2a !important;
    color: #fff !important;
    border-color: #444 !important;
    transform: translateY(-1px);
}
