/* ============================================
   Rosario Ya - Modal layer
   Canonical styles for cart and local detail modals.
   ============================================ */

.modal-overlay,
.modal-local-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    background: rgba(15, 23, 42, 0.48);
}

.modal-overlay.visible,
.modal-local-overlay.visible {
    display: flex;
}

.modal-overlay.visible {
    align-items: flex-end;
    justify-content: center;
}

.modal-local-overlay.visible {
    align-items: stretch;
    justify-content: center;
}

.modal-carrito,
.modal-local {
    background: #fff;
    color: #111827;
    border: 1px solid rgba(17, 24, 39, 0.08);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.modal-carrito {
    width: min(100%, 560px);
    max-height: min(86vh, 760px);
    border-radius: 28px 28px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header,
.modal-local-header {
    flex: 0 0 auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.modal-header h2 {
    margin: 0;
    color: #111827;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 850;
}

.btn-cerrar-modal,
.btn-cerrar-local {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 999px;
    background: #fff;
    color: #111827;
    box-shadow: none;
    cursor: pointer;
}

.modal-body,
.modal-local-content {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-body {
    flex: 1;
    padding: 18px 20px;
}

.modal-footer {
    flex: 0 0 auto;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    background: #fff;
}

.modal-local {
    position: relative;
    width: min(100%, 980px);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 0;
}

.btn-cerrar-local {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    z-index: 10020;
}

.modal-local-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: calc(22px + env(safe-area-inset-top)) 20px 18px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    background: #fff;
}

.modal-local-logo {
    width: 72px;
    height: 72px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 22px;
    background: #fff;
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.modal-local-info {
    min-width: 0;
    padding-right: 46px;
}

.modal-local-info h2 {
    margin: 0;
    color: #111827;
    font-size: clamp(1.35rem, 4vw, 2rem);
    line-height: 1.05;
    letter-spacing: 0;
    font-weight: 900;
}

.modal-local-info p {
    margin: 6px 0 0;
    color: #64748b;
    font-weight: 700;
}

.modal-local-tabs {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
    background: #fff;
}

.tab-local {
    flex: 1;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-weight: 850;
    cursor: pointer;
}

.tab-local.activa {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.modal-local-content {
    flex: 1;
    padding: 18px 20px 104px;
    background: #f8fafc;
}

.tab-content {
    display: none;
}

.tab-content.activa {
    display: block;
}

.modal-local .menu-categoria {
    margin: 18px 0 10px;
    color: #111827;
    font-size: .88rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.modal-local .menu-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 18px;
    background: #fff;
    box-shadow: none;
}

.modal-local .menu-item + .menu-item {
    margin-top: 10px;
}

.modal-local .menu-item:not(:has(.foto-producto)) {
    grid-template-columns: minmax(0, 1fr) auto;
}

.modal-local .foto-producto {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 16px;
}

.modal-local .menu-item-info {
    min-width: 0;
}

.modal-local .menu-item-nombre {
    display: block;
    color: #111827;
    font-weight: 850;
    line-height: 1.2;
}

.modal-local .menu-item-descripcion {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: .82rem;
    line-height: 1.35;
}

.modal-local .menu-item-precio-agregar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-local .precio {
    color: #111827;
    font-weight: 900;
}

.modal-local .btn-agregar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: #ff5a00;
    color: #fff;
    cursor: pointer;
}

.modal-local .opciones-submenu {
    grid-column: 1 / -1;
    display: none;
    padding: 12px;
    border-radius: 16px;
    background: #fff7ed;
    border: 1px solid rgba(255, 90, 0, 0.18);
}

.modal-local .opciones-submenu.open {
    display: block;
}

.opciones-titulo {
    margin-bottom: 10px;
    color: #111827;
    font-size: .86rem;
    font-weight: 850;
}

.opciones-grid {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.opcion-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid rgba(17, 24, 39, 0.10);
    border-radius: 12px;
    background: #fff;
    color: #334155;
    font-size: .84rem;
    cursor: pointer;
}

.opcion-check input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: #22c55e;
}

.opcion-check.marcada {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #166534;
    font-weight: 750;
}

.btn-confirmar-opciones {
    width: 100%;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    background: #22c55e;
    color: #fff;
    font-weight: 850;
    cursor: pointer;
}

.btn-confirmar-opciones.promo {
    background: #f97316;
}

.menu-vacio {
    padding: 36px 20px;
    border: 1px dashed rgba(17, 24, 39, 0.14);
    border-radius: 18px;
    background: #fff;
    color: #64748b;
    text-align: center;
    font-weight: 700;
}

.modal-info-content {
    display: grid;
    gap: 14px;
}

.modal-info-block {
    padding: 14px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 18px;
    background: #fff;
}

.modal-info-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-info-actions .btn {
    flex: 1 1 160px;
}

.modal-local::after {
    display: none !important;
    content: none !important;
}

.modal-local-cta {
    position: fixed !important;
    left: 18px !important;
    right: 18px !important;
    bottom: calc(18px + env(safe-area-inset-bottom)) !important;
    z-index: 10010 !important;
    width: min(560px, calc(100% - 36px)) !important;
    min-height: 56px !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    border: none !important;
    border-radius: 999px !important;
    background: #111827 !important;
    color: #fff !important;
    font-size: 1rem !important;
    font-weight: 900 !important;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.24) !important;
    transform: none !important;
    margin-inline: auto !important;
    cursor: pointer !important;
}

.modal-local-overlay.visible .modal-local-cta {
    display: flex !important;
}

body:has(.modal-local-overlay.visible) .carrito-flotante {
    display: none !important;
}

@media (min-width: 768px) {
    .modal-overlay.visible {
        align-items: center;
    }

    .modal-carrito {
        border-radius: 28px;
    }

    .modal-local {
        height: min(92vh, 860px);
        margin: auto 0;
        border-radius: 30px;
    }
}

@media (max-width: 560px) {
    .modal-carrito {
        width: 100%;
        max-height: 88vh;
    }

    .modal-local-header {
        padding-inline: 16px;
    }

    .modal-local-logo {
        width: 64px;
        height: 64px;
        border-radius: 20px;
    }

    .modal-local-content {
        padding: 14px 14px 98px;
    }

    .modal-local .menu-item,
    .modal-local .menu-item:not(:has(.foto-producto)) {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .modal-local .foto-producto {
        grid-column: 1 / -1;
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }
}
