/* cart.css - Panel de Carrito y Detalles de Compra */

.cart-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.cart-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--border);
    background: white;
}

.btn-close-cart-mobile { display: none; }

@media (max-width: 768px) {
    .cart-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 3000;
        display: none;
        animation: slideInRight 0.3s ease-out;
    }
    .cart-panel.active { display: flex; }
    .btn-close-cart-mobile {
        display: flex;
        background: #f1f5f9;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        justify-content: center;
        align-items: center;
    }
}

.cart-item {
    display: flex;
    flex-direction: column; /* Cambiamos a columna para dar más aire */
    gap: 10px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.cart-item-info { 
    flex: 1; 
}

.cart-item-info h4 {
    font-size: 0.95rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-main);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 100px;
    align-self: flex-end; /* Alineamos acciones a la derecha */
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.summary-row.total {
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
}

/* --- CONTROLES DE PAGO Y TAX --- */
.tax-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.tax-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.payment-method-selector { margin-bottom: 20px; }
.payment-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 5px;
}

.pay-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pay-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: white;
}

.pay-card i {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.pay-card span {
    font-size: 0.75rem;
    font-weight: 600;
}

.pay-opt input:checked + .pay-card {
    border-color: var(--accent);
    background: #fff1f2;
    color: var(--accent);
}

.pay-opt input:checked + .pay-card i {
    color: var(--accent);
}

.pay-opt.vip-credit input:checked + .pay-card {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #b45309;
}

.pay-opt.vip-credit input:checked + .pay-card i {
    color: #f59e0b;
}

/* --- RESUMEN COLAPSABLE --- */
.cart-summary-details {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    opacity: 0;
}

.cart-summary-details.active {
    max-height: 500px;
    opacity: 1;
    margin-bottom: 20px;
}
/* --- SELECTOR DE TIPO DE ORDEN --- */
.order-type-selector {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 12px;
    gap: 4px;
}

.order-type-pill {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.order-type-pill.active {
    background: white;
    color: var(--accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.order-type-pill[data-type="Pedidos Ya"].active {
    color: #e11d48; /* Color distintivo Pedidos Ya */
}

/* --- OPTIMIZACIÓN DESKTOP PREMIUM --- */
@media (min-width: 1024px) {
    /* 1. Panel de Carrito: Pie Fijo */
    .cart-panel {
        display: flex;
        flex-direction: column;
        height: 100%;
        background: #ffffff;
        border: 1px solid var(--border);
        box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    }

    .cart-header {
        padding: 20px 24px;
        flex-shrink: 0;
    }

    .cart-items {
        flex: 1;
        overflow-y: auto;
        padding: 0 24px;
        min-height: 220px; /* Punto de equilibrio para productos */
        scrollbar-width: thin;
        scrollbar-color: var(--border) transparent;
    }

    .cart-items::-webkit-scrollbar { width: 6px; }
    .cart-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

    .cart-footer {
        padding: 16px 24px;
        border-top: 1px solid var(--border);
        background: #f8fafc;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        max-height: 60%; /* Protege el espacio de los productos */
    }

    /* 2. Zero Clicks: Visibilidad con Scroll Interno */
    #btn-toggle-summary {
        display: none !important; 
    }

    .cart-summary-details {
        max-height: 200px !important; /* Límite para que no empuje los botones fuera */
        overflow-y: auto;
        opacity: 1 !important;
        display: block !important;
        margin-bottom: 12px;
        padding-bottom: 8px;
        padding-right: 5px;
        border-bottom: 1px dashed var(--border);
        scrollbar-width: thin;
    }

    /* 3. Ítems Legibles y Cómodos */
    .cart-item {
        padding: 10px 0;
        gap: 6px;
    }

    .cart-item-info h4 {
        font-size: 0.9rem;
    }
    
    .cart-item-info .status-dot {
        width: 8px !important;
        height: 8px !important;
        margin-top: 6px !important;
    }

    /* 4. Footer Organizado */
    .summary-rows-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 15px;
        margin-bottom: 10px;
    }
    
    .summary-row {
        margin-bottom: 0 !important;
        font-size: 0.8rem !important;
    }

    .summary-row.total {
        display: flex;
        grid-column: 1 / span 2;
        margin-bottom: 12px;
        padding: 10px 15px;
        background: white;
        border-radius: 12px;
        border: 1px solid var(--border);
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    }
    
    .summary-row.total span {
        font-size: 1.4rem !important;
    }

    /* 5. Grid de Pagos Balanceado (3 Columnas) */
    .payment-options {
        grid-template-columns: repeat(3, 1fr); 
        gap: 8px;
    }

    .pay-card {
        padding: 12px 4px;
    }

    .pay-card i {
        width: 20px;
        height: 20px;
    }

    .pay-card span {
        font-size: 0.7rem;
    }
    
    /* Ajustes de espaciado */
    .tax-controls { margin-bottom: 8px; padding-bottom: 8px; gap: 10px; }
    .tax-toggle { font-size: 0.75rem; }
    .order-type-selector { margin-bottom: 12px; padding: 4px; }
    .order-type-pill { padding: 6px 4px; font-size: 0.75rem; }
    .discount-control { margin-bottom: 12px; }
    #cart-discount { padding: 8px; font-size: 1rem; height: 40px; }
    #btn-toggle-discount-type { height: 28px; font-size: 0.7rem; padding: 4px 10px; }

    /* 6. Botones de Acción de Alto Impacto (Fijos y Visibles) */
    .main-cart-actions {
        gap: 8px !important;
        flex-shrink: 0;
    }

    #checkout-btn, #btn-send-kitchen {
        height: 52px;
        font-size: 1rem;
        letter-spacing: 0.5px;
        font-weight: 700;
    }
}
