/* ═══════════════════════════════════════════════════════════
   El Couzina — Menu page mobile enhancements
   Search, morphing pill, expandable cards, allergens, favorites
   ═══════════════════════════════════════════════════════════ */

/* ─── Menu toolbar (search + jump button) ────────────── */
.menu-toolbar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    align-items: stretch;
}

.menu-search {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0 var(--space-4);
    transition: all var(--duration) var(--ease);
}

.menu-search:focus-within {
    border-color: var(--primary);
    background: var(--bg);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.12);
}

.menu-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: var(--space-3);
}

.menu-search input {
    flex: 1;
    border: none;
    background: transparent;
    padding: var(--space-3) 0;
    font-size: 15px;
    color: var(--text);
    outline: none;
    min-height: 44px;
}

.menu-search input::placeholder {
    color: var(--text-muted);
}

.menu-search-clear {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-alt);
    color: var(--text-secondary);
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.menu-jump-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: grid;
    place-items: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.3);
    transition: transform var(--duration) var(--ease);
}

.menu-jump-btn:hover,
.menu-jump-btn:active {
    transform: scale(1.05);
}

.menu-jump-btn svg {
    width: 22px;
    height: 22px;
}

/* ─── Menu tabs with morphing pill ───────────────────── */
.menu-tabs { position: relative; }

.menu-tabs-inner {
    scroll-snap-type: x proximity;
    scroll-padding-left: var(--space-6);
    padding: var(--space-4) var(--space-1);
}

.menu-tab { scroll-snap-align: start; }

.menu-tabs-pill {
    position: absolute;
    top: var(--space-4);
    left: 0;
    height: calc(100% - var(--space-8));
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transition: transform 0.5s var(--ease-elastic), width 0.5s var(--ease-elastic), opacity 0.25s var(--ease);
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

.menu-tabs-pill.is-ready { opacity: 1; }

.menu-tab {
    position: relative;
    z-index: 1;
    background: transparent !important;
    transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.menu-tab.active {
    color: white !important;
    border-color: transparent !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* ─── No results state ───────────────────────────────── */
.menu-no-results {
    text-align: center;
    padding: var(--space-16) var(--space-6);
    color: var(--text-muted);
    display: none;
}

.menu-no-results.is-visible { display: block; }

.menu-no-results-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.menu-no-results-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    color: var(--text);
    margin-bottom: var(--space-2);
}

/* Section hidden when filtered empty */
.category-section[hidden] { display: none; }
.menu-item[hidden] { display: none; }

/* ─── Search highlight ───────────────────────────────── */
.menu-item-name mark,
.menu-item-desc mark {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-dark);
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

/* ─── Favorite heart ─────────────────────────────────── */
.menu-item-fav {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: none;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 2;
    transition: all var(--duration) var(--ease);
    color: var(--text-muted);
    -webkit-tap-highlight-color: transparent;
}

.menu-item-fav:hover,
.menu-item-fav:active {
    background: white;
    transform: scale(1.1);
}

.menu-item-fav svg {
    width: 18px;
    height: 18px;
    fill: transparent;
    stroke: currentColor;
    stroke-width: 2;
    transition: all var(--duration) var(--ease);
}

.menu-item.is-fav .menu-item-fav {
    color: #e0474c;
    background: white;
}

.menu-item.is-fav .menu-item-fav svg {
    fill: currentColor;
    stroke: currentColor;
    animation: heartPop 0.45s var(--ease-elastic);
}

@keyframes heartPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ─── Expandable card details ────────────────────────── */
.menu-item-expand {
    margin-top: var(--space-3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.menu-item-expand:hover,
.menu-item-expand:active {
    color: var(--primary);
    border-color: var(--primary);
}

.menu-item-expand svg {
    width: 14px;
    height: 14px;
    transition: transform var(--duration) var(--ease);
}

.menu-item.is-expanded .menu-item-expand svg {
    transform: rotate(180deg);
}

.menu-item-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s var(--ease-out-expo);
}

.menu-item.is-expanded .menu-item-details {
    max-height: 400px;
}

.menu-item-details-inner {
    padding-top: var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

.menu-item-details-label {
    display: block;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    font-size: 10px;
    color: var(--primary);
    margin-bottom: var(--space-2);
}

/* ─── Category heading anchor offset ─────────────────── */
.category-section {
    scroll-margin-top: calc(var(--header-height) + 120px);
}

/* ─── Menu toolbar mobile adjustments ────────────────── */
@media (max-width: 767px) {
    .menu-toolbar {
        margin-bottom: var(--space-4);
    }

    .menu-search input {
        font-size: 16px; /* prevent iOS zoom on focus */
    }
}
