/* ═══════════════════════════════════════════════════════
   CARRITO / PEDIDOS POR WHATSAPP
   Estilos self-contained: no dependen de las variables de
   cada template, así se ven consistentes en los 8 diseños.
   Acento verde WhatsApp para las acciones de pedido.
═══════════════════════════════════════════════════════ */

:root {
    --wa-green: #25D366;
    --wa-green-dark: #1da851;
    --cart-bg: #ffffff;
    --cart-text: #1f2529;
    --cart-muted: #6b7480;
    --cart-line: #e7eaee;
}

/* ── Botón "Agregar" en cada card ─────────────────────── */
.btn-agregar-carrito {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: var(--wa-green);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s ease, transform .05s ease;
}

.btn-agregar-carrito:hover { background: var(--wa-green-dark); }
.btn-agregar-carrito:active { transform: scale(.97); }

/* ── Botón flotante (FAB) del carrito ─────────────────── */
.carrito-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1080;
    display: none; /* se muestra por JS solo si los pedidos están activos */
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--wa-green);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
    cursor: pointer;
    transition: transform .12s ease, background .15s ease;
}

.carrito-fab:hover { background: var(--wa-green-dark); transform: translateY(-2px); }
.carrito-fab.visible { display: inline-flex; }

/* Badge con la cantidad de items */
.carrito-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    background: #e0342b;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

/* ── Panel lateral del carrito ────────────────────────── */
.carrito-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    width: 380px;
    max-width: 92vw;
    height: 100%;
    background: var(--cart-bg);
    color: var(--cart-text);
    box-shadow: -8px 0 30px rgba(0, 0, 0, .25);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.16, 1, .3, 1);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.carrito-panel.abierto { transform: translateX(0); }

.carrito-overlay {
    position: fixed;
    inset: 0;
    z-index: 1085;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}

.carrito-overlay.abierto { opacity: 1; visibility: visible; }

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

.carrito-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.carrito-cerrar {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: var(--cart-muted);
    cursor: pointer;
}

.carrito-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px;
}

.carrito-vacio {
    text-align: center;
    color: var(--cart-muted);
    padding: 40px 10px;
    font-size: 15px;
}

/* ── Item del carrito ─────────────────────────────────── */
.carrito-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--cart-line);
}

.carrito-item-info { flex: 1; min-width: 0; }

.carrito-item-nombre {
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.carrito-item-precio { font-size: 13px; color: var(--cart-muted); }

.carrito-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.carrito-qty button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--cart-line);
    border-radius: 8px;
    background: #f6f7f9;
    color: var(--cart-text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.carrito-qty button:hover { background: #eceef1; }
.carrito-qty span { min-width: 18px; text-align: center; font-weight: 600; font-size: 14px; }

/* ── Banner de mesa (cuando se entra por un QR) ───────── */
.carrito-mesa-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(37, 211, 102, .12);
    border: 1px solid rgba(37, 211, 102, .35);
    color: var(--cart-text);
    font-size: 14px;
}

.carrito-mesa-banner i { color: var(--wa-green-dark); }

/* ── Formulario de datos del pedido ───────────────────── */
.carrito-form { margin-top: 8px; }
.carrito-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0 4px;
}

.carrito-form input,
.carrito-form select,
.carrito-form textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--cart-line);
    border-radius: 9px;
    font-size: 14px;
    background: #fff;
    color: var(--cart-text);
}

.carrito-form textarea { resize: vertical; min-height: 54px; }

/* ── Footer con total + botón enviar ──────────────────── */
.carrito-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--cart-line);
    background: var(--cart-bg);
}

.carrito-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-size: 16px;
}

.carrito-total strong { font-size: 20px; }

.carrito-enviar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 12px;
    background: var(--wa-green);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease;
}

.carrito-enviar:hover { background: var(--wa-green-dark); }
.carrito-enviar:disabled { opacity: .5; cursor: not-allowed; }
