/* MenuDigital - Tema Galería + Lista (global)
   Galería de fotos propias a un lado + menú texto al otro. */
@import url('base.css?v=5.16');

:root {
    --theme-bg: #f8faf9;
    --theme-surface: #ffffff;
    --theme-text: #1a2e28;
    --theme-text-muted: #64748b;
    --theme-primary: #1B4332;
    --theme-secondary: #52796F;
    --theme-accent: #2d6a4f;
    --theme-border: #e2e8f0;
    --theme-font-heading: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --theme-font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --gallery-tile-width: 148px;
}

body {
    background: var(--theme-bg);
    color: var(--theme-text);
}

/* Encabezado: logo, nombre y descripción centrados; contacto a la izquierda */
.menu-header {
    padding: 1.25rem 1rem 1.15rem;
    padding-top: max(1.25rem, calc(env(safe-area-inset-top, 0px) + 0.65rem));
    text-align: left;
}

.menu-header-content {
    max-width: 100%;
    margin: 0 auto;
    text-align: left;
}

.menu-header .restaurant-logo {
    margin: 0 auto 0.85rem;
}

.restaurant-name {
    font-size: clamp(1.35rem, 5.5vw, 2rem);
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
    text-align: center;
}

.restaurant-description {
    max-width: 100%;
    font-size: 0.88rem;
    line-height: 1.45;
    padding: 0;
    word-break: break-word;
    text-align: center;
    margin: 0 auto;
}

.restaurant-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    width: 100%;
    max-width: none;
    margin: 0.85rem 0 0;
}

.restaurant-info span {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    line-height: 1.4;
    word-break: break-word;
    white-space: normal;
}

.social-links {
    margin-top: 0.85rem;
    justify-content: flex-start;
}

/* Layout fijo: sin toggle grid/lista */
#viewToggle {
    display: none !important;
}

/* Layout: galería | menú */
.photo-gallery-split {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.photo-gallery-aside {
    width: 100%;
    background: var(--theme-surface);
    border-bottom: 1px solid var(--theme-border);
}

.photo-gallery-main {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.photo-gallery-main--full .menu-content.theme-photo-gallery {
    max-width: 720px;
    margin: 0 auto;
}

.menu-content.theme-photo-gallery {
    max-width: none;
    margin: 0;
    padding: 1rem 0.75rem 1.5rem;
}

@media (min-width: 900px) {
    .photo-gallery-split {
        flex-direction: row;
        align-items: stretch;
        min-height: calc(100vh - 220px);
    }

    .photo-gallery-aside {
        flex: 0 0 min(42%, 420px);
        max-width: 420px;
        border-bottom: none;
        border-right: 1px solid var(--theme-border);
        position: sticky;
        top: 0;
        align-self: flex-start;
        max-height: 100vh;
        overflow-y: auto;
        padding: 1rem 0.85rem 1.25rem;
    }

    .photo-gallery-main {
        flex: 1 1 auto;
        min-width: 0;
        overflow-y: auto;
    }

    .photo-gallery-aside .menu-global-gallery {
        margin: 0;
    }

    .photo-gallery-aside .gallery-strip {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        max-height: calc(100vh - 4rem);
        padding: 0.25rem 0 0.5rem;
        scroll-snap-type: y proximity;
    }

    .photo-gallery-aside .gallery-tile {
        flex: 0 0 auto;
        width: 100%;
        scroll-snap-align: start;
    }

    .menu-content.theme-photo-gallery {
        padding: 1.25rem 1.25rem 2rem;
    }
}

/* ==========================================
   GALERÍA GLOBAL
   ========================================== */

.menu-global-gallery {
    margin: 0 0 1.75rem;
    padding: 0;
}

.menu-global-gallery.is-empty,
.menu-global-gallery[style*="display: none"],
.menu-global-gallery[style*="display:none"] {
    display: none !important;
    margin: 0;
    padding: 0;
}

.menu-global-gallery .gallery-strip:empty {
    display: none;
}

.menu-global-gallery:has(.gallery-strip:empty) {
    display: none !important;
    margin: 0;
    padding: 0;
}

.menu-global-gallery:has(.gallery-strip:empty) + .photo-gallery-main,
.photo-gallery-split:not(:has(.photo-gallery-aside)) .photo-gallery-main {
    width: 100%;
}

.menu-global-gallery-title {
    font-family: var(--theme-font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--theme-text-muted);
    margin: 0 0 0.65rem;
    padding: 0 0.15rem;
}

.gallery-strip {
    display: flex;
    flex-direction: row;
    gap: 0.65rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0 0.85rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-primary) transparent;
}

.gallery-strip::-webkit-scrollbar {
    height: 5px;
}

.gallery-strip::-webkit-scrollbar-thumb {
    background: rgba(27, 67, 50, 0.35);
    border-radius: 999px;
}

.gallery-tile {
    flex: 0 0 var(--gallery-tile-width);
    width: var(--gallery-tile-width);
    scroll-snap-align: start;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background: var(--theme-surface);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--theme-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.gallery-tile:active {
    transform: scale(0.98);
}

.gallery-tile .gallery-tile-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: #eef2f0;
}

.gallery-tile .gallery-tile-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 5;
    font-size: 2rem;
    background: linear-gradient(145deg, #eef2f0, #e2e8e6);
    color: var(--theme-text-muted);
}

.gallery-tile .dish-badges {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    z-index: 2;
    pointer-events: none;
}

.gallery-tile .dish-badge {
    font-size: 0.55rem;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--theme-text);
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.gallery-tile .favorite-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    z-index: 3;
}

.gallery-tile .favorite-btn::before {
    width: 28px;
    height: 28px;
}

.gallery-tile.unavailable {
    opacity: 0.55;
}

.gallery-tile.unavailable::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

.gallery-photo-tile .gallery-photo-caption {
    padding: 0.35rem 0.5rem 0.42rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    line-height: 1.25;
    background: var(--theme-surface);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.gallery-lightbox-inner {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 720px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-lightbox-inner img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
}

.gallery-lightbox-caption {
    margin: 0.75rem 0 0;
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.9;
}

/* ==========================================
   LISTA SOLO TEXTO
   ========================================== */

.dishes-text-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.text-row {
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0.42rem 0;
    margin: 0;
    position: relative;
    cursor: default;
    display: block;
    border-bottom: 1px solid var(--theme-border);
    transition: background 0.2s;
}

.text-row.dish-card:hover {
    transform: none;
    box-shadow: none;
}

.text-row--orderable {
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

body.gallery-order-mode .text-row--orderable {
    cursor: pointer;
}

body.gallery-order-mode .text-row--orderable:not(.text-row--selected) .text-row-add-btn {
    animation: galleryAddBtnPulse 1.6s ease-in-out infinite;
}

body.gallery-order-mode .text-row--selected {
    background: rgba(27, 67, 50, 0.06);
}

body.gallery-order-mode .text-row--orderable:active {
    background: rgba(27, 67, 50, 0.08);
}

.text-row--added {
    background: rgba(27, 67, 50, 0.1);
}

.text-row--in-cart .dish-name,
.text-row--selected .dish-name {
    color: var(--theme-primary);
}

.text-row-stepper {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-left: 0.35rem;
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 999px;
    padding: 2px;
}

.text-row-add-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: none;
    border-radius: 50%;
    background: var(--theme-primary);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 0.35rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.text-row-add-btn:active {
    transform: scale(0.94);
}

.text-row-stepper-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--theme-primary);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.text-row-stepper-plus {
    background: var(--theme-primary);
    color: #fff;
}

.text-row-stepper-minus:active,
.text-row-stepper-plus:active,
.text-row-add-btn:active {
    transform: scale(0.94);
}

.text-row-stepper-qty {
    min-width: 1.35rem;
    padding: 0 0.15rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    color: var(--theme-text);
}

.text-row .dish-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
}

.text-row .dish-name {
    font-family: var(--theme-font-heading);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--theme-text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.25;
}

.text-row .dish-name::after {
    display: none;
}

.text-row:last-child {
    border-bottom: none;
}

.text-row .dish-info {
    padding: 0;
    min-width: 0;
}

.text-row--interactive:not(.text-row--orderable) {
    cursor: pointer;
}

.text-row--interactive:not(.text-row--orderable):hover .dish-name {
    color: var(--theme-primary);
}

.text-row .dish-price {
    font-family: var(--theme-font-body);
    font-variant-numeric: tabular-nums;
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--theme-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.text-row .dish-description {
    font-size: 0.72rem;
    color: var(--theme-text-muted);
    line-height: 1.35;
    margin: 0.18rem 0 0;
    padding-right: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.text-row.expanded .dish-description {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.text-row .dish-options-preview {
    font-size: 0.7rem;
    color: var(--theme-text-muted);
    margin: 0.12rem 0 0;
    line-height: 1.3;
    opacity: 0.92;
}

.text-row .dish-meta {
    margin-top: 0.18rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.28rem;
}

.text-row .add-to-cart-btn,
.text-row .favorite-btn {
    display: none !important;
}

@keyframes galleryAddBtnPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(27, 67, 50, 0.22);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 4px 14px rgba(27, 67, 50, 0.35);
    }
}

@keyframes galleryPedirBtnPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 6px 22px rgba(27, 67, 50, 0.32);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 10px 30px rgba(27, 67, 50, 0.42);
    }
}

/* Barra Pedir — tema galería: bien visible antes de seleccionar */
#galleryOrderBar.gallery-order-bar.is-visible,
body.menu-theme-photo-gallery #galleryOrderBar.is-visible {
    display: flex !important;
    visibility: visible !important;
    background: linear-gradient(to top, var(--theme-surface, #fff) 92%, transparent);
    z-index: 1105;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

body.menu-theme-photo-gallery.menu-orders-bar-visible #menuContainer,
body.menu-theme-photo-gallery:has(#galleryOrderBar.is-visible) #menuContainer {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) #galleryOrderBar.is-visible {
    padding: 0.35rem clamp(0.5rem, 2.5vw, 0.75rem) calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-bar-inner--idle {
    gap: 0.28rem;
    padding: 0.32rem 0.5rem;
    border-radius: 12px;
    border: 1.5px solid var(--theme-primary);
    box-shadow: 0 3px 16px rgba(0, 0, 0, 0.1);
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-start-btn {
    min-height: 38px;
    padding: 0.38rem 0.65rem;
    font-size: 0.88rem;
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    animation: none;
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-start-icon {
    font-size: 0.92rem;
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-view-btn--secondary {
    min-height: 38px;
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
    border-radius: 11px;
    border-width: 1.5px !important;
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-view-btn--secondary .gallery-order-count {
    min-width: 1.05rem;
    height: 1.05rem;
    font-size: 0.7rem;
    padding: 0 0.22rem;
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-bar-inner--idle.gallery-order-bar-inner--has-cart {
    flex-direction: row;
    align-items: stretch;
    gap: 0.35rem;
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-bar-inner--has-cart .gallery-order-start-btn {
    flex: 1.15;
    min-width: 0;
}

body.menu-theme-photo-gallery:not(.gallery-order-mode) .gallery-order-bar-inner--has-cart .gallery-order-view-btn--secondary {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

body.menu-theme-photo-gallery.gallery-order-mode.menu-orders-bar-visible #menuContainer,
body.menu-theme-photo-gallery.gallery-order-mode:has(#galleryOrderBar.is-visible) #menuContainer {
    padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
}

body.menu-theme-photo-gallery.gallery-order-mode .gallery-order-mode-label,
body.menu-theme-photo-gallery.gallery-order-mode .gallery-order-hint {
    display: none;
}

body.menu-theme-photo-gallery.gallery-order-mode .gallery-order-bar-inner--active {
    gap: 0.28rem;
    padding: 0.4rem 0.55rem 0.32rem;
}

body.menu-theme-photo-gallery.gallery-order-mode .gallery-order-view-btn--primary {
    min-height: 40px;
    font-size: 0.9rem;
}

body.menu-theme-photo-gallery.gallery-order-mode .gallery-order-cancel-btn {
    margin-top: 0;
    font-size: 0.74rem;
}

body.menu-theme-photo-gallery #galleryOrderBar.is-visible {
    left: 0;
    right: 0;
    width: 100%;
    align-items: stretch;
    justify-content: flex-end;
}

body.menu-theme-photo-gallery #galleryOrderBar .gallery-order-bar-inner {
    align-self: center;
    width: 100%;
    max-width: min(560px, calc(100vw - 1.3rem));
}

.gallery-tile--interactive {
    cursor: pointer;
}

.gallery-tile:not(.gallery-tile--interactive) {
    cursor: default;
}

/* Secciones */
.menu-section {
    margin-bottom: 2rem;
}

.section-header {
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--theme-primary);
}

.section-title {
    font-family: var(--theme-font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--theme-text);
    margin: 0;
}

.section-icon {
    margin-right: 0.35rem;
}

/* Ocultar imágenes en filas (por si acaso) */
.text-row .dish-image-container {
    display: none !important;
}

/* Plato del día en tema galería: solo texto, sin mini-fotos */
.featured-today-text-only img {
    display: none !important;
}

@media (max-width: 400px) {
    .text-row .dish-name::after {
        display: none;
    }
}

@media (min-width: 640px) {
    :root {
        --gallery-tile-width: 168px;
    }

    .gallery-strip {
        gap: 0.85rem;
    }
}

/* Sin barra de búsqueda fija — se usa la lupa flotante */
.search-bar {
    display: none !important;
}

.categories-nav {
    border-bottom: none;
    padding-bottom: 0.35rem;
}

#searchToggleBtn.active {
    background: var(--theme-primary);
    color: #fff;
}

.gallery-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
}

.gallery-search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

.gallery-search-sheet {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
    padding-top: max(0.55rem, env(safe-area-inset-top, 0px));
    background: var(--theme-surface);
    border-bottom: 1px solid var(--theme-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.gallery-search-input-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.gallery-search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--theme-text-muted);
    pointer-events: none;
}

.gallery-search-input {
    width: 100%;
    padding: 0.62rem 2.35rem 0.62rem 2.35rem;
    border: 1.5px solid var(--theme-border);
    border-radius: 999px;
    background: var(--theme-bg);
    font-size: 0.95rem;
    color: var(--theme-text);
}

.gallery-search-input:focus {
    outline: none;
    border-color: var(--theme-primary);
    background: #fff;
}

.gallery-search-clear {
    position: absolute;
    right: 0.45rem;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: var(--theme-text-muted);
    color: #fff;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-search-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--theme-bg);
    color: var(--theme-text-muted);
    font-size: 0.95rem;
    cursor: pointer;
}
