﻿/* =========================================================
   LA WAFFLERIA — Carrito de pedidos
   ========================================================= */

/* --- Botón flotante del carrito --- */
.carrito-flotante {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
}

.carrito-btn {
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 50px;
    padding: 1rem 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(111, 60, 153, 0.42);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

    .carrito-btn:hover {
        background: var(--color-secondary);
        transform: translateY(-3px);
        box-shadow: 0 10px 28px rgba(111, 60, 153, 0.5);
    }

.carrito-btn-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.carrito-btn-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.carrito-contador {
    background: var(--color-secondary);
    color: var(--color-white);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform 0.3s ease;
}

    .carrito-contador.bump {
        animation: bump 0.3s ease;
    }

@keyframes bump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* --- Panel lateral del carrito --- */
.carrito-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.carrito-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    height: 100dvh;
    background: var(--color-surface);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 30px rgba(0,0,0,0.15);
}

    .carrito-panel.abierto {
        right: 0;
    }

/* Header del panel */
.carrito-header {
    background: var(--color-secondary);
    color: var(--color-white);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

    .carrito-header h2 {
        font-family: var(--font-heading);
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

.carrito-cerrar {
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--color-white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

    .carrito-cerrar:hover {
        background: rgba(255,255,255,0.3);
    }

/* Cuerpo scrollable */
.carrito-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Estado vacío */
.carrito-vacio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--color-muted);
    gap: 1rem;
}

.carrito-vacio-icon {
    font-size: 4rem;
}

.carrito-vacio h3 {
    font-family: var(--font-heading);
    color: var(--color-text);
}

.carrito-vacio p {
    font-size: 0.9rem;
}

/* Items del carrito */
.carrito-item {
    background: #fffdfa;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid var(--color-border);
    position: relative;
}

.carrito-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.carrito-item-nombre {
    font-weight: 700;
    color: var(--color-text);
    font-size: 0.98rem;
}

.carrito-item-precio {
    color: var(--color-product);
    font-weight: 700;
    font-size: 0.98rem;
    white-space: nowrap;
}

.carrito-item-detalles {
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

    .carrito-item-detalles span {
        display: block;
    }

.carrito-item-eliminar {
    background: #fee2e2;
    border: none;
    color: #dc2626;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    margin-top: 0.25rem;
}

    .carrito-item-eliminar:hover {
        background: #fecaca;
    }

/* Footer del carrito */
.carrito-footer {
    border-top: 2px solid var(--color-border);
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
    background: var(--color-surface);
}

.carrito-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.carrito-total-label {
    font-weight: 700;
    color: var(--color-text);
    font-size: 1.05rem;
}

.carrito-total-precio {
    font-weight: 700;
    color: var(--color-product);
    font-size: 1.3rem;
}

.carrito-aviso {
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
    text-align: center;
}

.carrito-btn-pedido {
    width: 100%;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 50px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

    .carrito-btn-pedido:hover {
        background: var(--color-secondary);
        transform: translateY(-2px);
    }

.carrito-btn-vaciar {
    width: 100%;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    border-radius: 50px;
    padding: 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s;
    font-family: var(--font-body);
}

    .carrito-btn-vaciar:hover {
        border-color: #dc2626;
        color: #dc2626;
    }

/* =========================================================
   MODAL DE PERSONALIZACIÓN
   ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 20000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal-panel {
    background: var(--color-surface);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.modal-overlay.abierto .modal-panel {
    transform: translateY(0);
}

.modal-header {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}

    .modal-header h3 {
        font-family: var(--font-heading);
        color: var(--color-text);
        font-size: 1.2rem;
    }

.modal-cerrar {
    background: rgba(111, 60, 153, 0.12);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.25rem 1.5rem;
}

/* Secciones del modal */
.modal-seccion {
    margin-bottom: 1.75rem;
}

.modal-seccion-titulo {
    font-weight: 700;
    color: var(--color-text);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal-seccion-subtitulo {
    font-size: 0.78rem;
    color: var(--color-muted);
    margin-bottom: 0.75rem;
}

/* Opciones radio/check */
.opcion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.opcion-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fffdfa;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

    .opcion-item:hover {
        border-color: var(--color-product);
    }

    .opcion-item.seleccionado {
        border-color: var(--color-secondary);
        background: rgba(0, 177, 218, 0.1);
        color: var(--color-secondary);
        font-weight: 600;
        box-shadow: 0 0 0 3px rgba(111, 60, 153, 0.16);
    }

    .opcion-item input {
        display: none;
    }

.opcion-nombre {
    flex: 1;
    color: var(--color-text);
}

.opcion-precio {
    color: var(--color-product);
    font-weight: 600;
    font-size: 0.78rem;
}

/* Toppings con contador */
.topping-contador {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fffdfa;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.4rem;
    transition: border-color 0.2s;
}

    .topping-contador.activo {
        border-color: var(--color-secondary);
        background: rgba(0, 177, 218, 0.1);
        box-shadow: 0 0 0 3px rgba(111, 60, 153, 0.16);
    }

.topping-info {
    flex: 1;
}

.topping-nombre {
    font-size: 0.88rem;
    color: var(--color-text);
    font-weight: 500;
}

.topping-precio {
    font-size: 0.78rem;
    color: var(--color-product);
    font-weight: 600;
}

.topping-controles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topping-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--color-text);
    transition: all 0.2s;
    line-height: 1;
}

    .topping-btn:hover {
        border-color: var(--color-product);
        color: var(--color-product);
    }

    .topping-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }

.topping-cantidad {
    font-weight: 700;
    color: var(--color-text);
    min-width: 16px;
    text-align: center;
    font-size: 0.95rem;
}

/* Cubiertos */
.cubiertos-opciones {
    display: flex;
    gap: 0.75rem;
}

    .cubiertos-opciones .opcion-item {
        flex: 1;
        justify-content: center;
        font-size: 0.95rem;
    }

/* Footer del modal */
.modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--color-surface);
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

.modal-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--color-text);
}

.modal-subtotal-precio {
    color: var(--color-product);
    font-size: 1.1rem;
}

.modal-btn-agregar {
    width: 100%;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: 50px;
    padding: 0.9rem;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.3s;
}

    .modal-btn-agregar:hover {
        background: var(--color-secondary);
    }

    .modal-btn-agregar:disabled {
        background: #ccc;
        cursor: not-allowed;
    }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 768px) {
    .modal-overlay {
        align-items: center;
    }

    .modal-panel {
        border-radius: 20px;
        max-height: 85vh;
    }

    .carrito-panel {
        max-width: 330px;
    }
}
/* =========================================================
   CARRITO FLOTANTE — Móvil: solo ícono circular
   ========================================================= */
@media (max-width: 767px) {

    .carrito-btn {
        padding: 0;
        width: 58px;
        height: 58px;
        border-radius: 50%;
        justify-content: center;
        gap: 0;
    }

    /* Ocultar el texto "Mi pedido" en móvil */
    #carritoBtnTexto {
        display: none;
    }

    /* Reposicionar el contador encima del ícono */
    .carrito-contador {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 22px;
        height: 22px;
        font-size: 0.72rem;
    }

    .carrito-flotante {
        bottom: 1.5rem;
        right: 1.5rem;
    }

    /* Necesario para que el contador se posicione bien */
    .carrito-btn {
        position: relative;
    }
}
/* =========================================================
   TOAST — Confirmación de producto agregado
   ========================================================= */
.toast {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--color-secondary);
    color: var(--color-white);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(111, 60, 153, 0.34);
    z-index: 99999;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

    .toast.visible {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
/* Botones de acción del item */
.carrito-item-acciones {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.carrito-item-editar {
    background: rgba(0, 177, 218, 0.16);
    border: none;
    color: var(--color-secondary);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

    .carrito-item-editar:hover {
        background: rgba(0, 177, 218, 0.26);
    }



/* Aviso de horario (reemplazo de alert nativo) */
.horario-aviso-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: grid;
    place-items: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 12000;
}

@media (max-width: 480px) {
    .carrito-flotante {
        bottom: 1.1rem;
        right: 1.05rem;
    }

    .carrito-panel {
        max-width: 100%;
    }

    .carrito-body {
        padding: 1rem;
    }

    .carrito-footer {
        padding: 1rem 1rem 1.15rem;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 375px) {
    .carrito-btn {
        width: 54px;
        height: 54px;
    }

    .carrito-item {
        padding: 0.85rem;
    }

    .opcion-grid {
        grid-template-columns: 1fr;
    }

    .toast {
        width: min(92vw, 340px);
        text-align: center;
        white-space: normal;
        border-radius: 14px;
        padding: 0.7rem 0.9rem;
    }
}

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

.horario-aviso-modal {
    width: min(92vw, 460px);
    background: #fffdfa;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
    padding: 1.1rem 1rem 0.95rem;
}

.horario-aviso-modal h3 {
    font-family: var(--font-heading);
    color: var(--color-text);
    margin-bottom: 0.35rem;
    font-size: 1.2rem;
}

.horario-aviso-modal p {
    color: var(--color-muted);
    line-height: 1.45;
    font-size: 0.95rem;
    margin-bottom: 0.95rem;
}

.horario-aviso-btn {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 0.78rem 1rem;
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--color-white);
    cursor: pointer;
}

.horario-aviso-btn:hover {
    filter: brightness(0.97);
}

.carrito-btn-pedido.shake {
    animation: carritoBtnShake 0.38s ease;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.35);
}

@keyframes carritoBtnShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

