/* ============================================
   Menu Panel - Slide-in Side Navigation
   ============================================ */

/* Overlay */
.menu-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    /* Brand-tinted overlay (primary @ 40%) instead of flat black — the
       panel-open backdrop now carries tenant identity. */
    background: color-mix(in srgb, var(--color-primary) 40%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.menu-panel-overlay[hidden] {
    display: block !important;
    opacity: 0;
    pointer-events: none;
}

.menu-panel-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Panel */
.menu-panel {
    position: fixed;
    top: 12px;
    left: 0;
    bottom: 12px;
    z-index: 210;
    width: 280px;
    max-width: 80vw;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    border-radius: 0 18px 18px 0;
    overflow: hidden;
}

.menu-panel[hidden] {
    display: flex !important;
}

.menu-panel.is-open {
    transform: translateX(0);
}

body.theme-light .menu-panel {
    background: #ffffff;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.08);
}

body:not(.theme-light) .menu-panel {
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.4);
}

/* Page push effect */
.page-wrap {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-radius 0.4s ease;
    will-change: transform;
    position: relative;
    z-index: 1;
    min-height: 100dvh;
}

.page-wrap.is-pushed {
    /* Push the page 200px (panel = 280px). The panel's right ~80px
       still floats OVER the page, casting its shadow onto the visible
       page area — "elevated modal" feel, not a drawer that shoves the
       page aside. */
    transform: translateX(200px) scale(0.94);
    /* Anchor the shrink at the top so the visible top edge stays put.
       Default origin (center) makes a tall page appear to shift DOWN
       when scaled. */
    transform-origin: top center;
    border-radius: 16px;
    overflow: hidden;
    pointer-events: none;
}

body.theme-light .page-wrap.is-pushed {
    box-shadow: -4px 0 40px rgba(0, 0, 0, 0.08);
}

body:not(.theme-light) .page-wrap.is-pushed {
    box-shadow: -4px 0 40px rgba(0, 0, 0, 0.3);
}

/* ---- Panel Header ---- */
.menu-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* Explicit `height` (not just max-height) so SVG logos without an
   intrinsic width/height attribute still get sized — otherwise the
   browser renders them at 0×0 and the logo silently disappears
   from the sidebar while the DOM element stays present. Same fix
   we applied to .top-header__logo-img. */
.menu-panel__logo {
    height: 42px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

.menu-panel__brand {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
}

.menu-panel__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.menu-panel__close:active {
    transform: scale(0.9);
    color: var(--color-text);
}

body.theme-light .menu-panel__close {
    background: rgba(0, 0, 0, 0.04);
}

body:not(.theme-light) .menu-panel__close {
    background: var(--color-bg-glass-strong);
}

/* ---- Scrollable Area ----
   Holds ONLY the accordion list now. The featured rail moved out
   to be a sibling that anchors at the bottom of the panel — that
   way long category lists scroll independently without pushing
   the "Önerilen Ürünler" rail off-screen. */
.menu-panel__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-sm) 0;
    overscroll-behavior: contain;
}

/* Inner wrapper kept for layout symmetry — used to also constrain
   `margin-top:auto` on featured, but that's no longer needed since
   featured is a sibling. Left as a thin wrapper so the existing
   structure stays unchanged. */
.menu-panel__scroll-inner {
    display: flex;
    flex-direction: column;
}

/* ---- Accordion ---- */
.menu-accordion {
    border-bottom: 1px solid var(--color-border);
}

.menu-accordion:last-child {
    border-bottom: none;
}

/* Trigger button (or direct link for single-cat bölümler) */
.menu-accordion__trigger {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    transition: background var(--transition-fast);
    color: var(--color-text);
}

/* Direct-link variant — used when a bölüm has exactly one visible
   category for the current outlet. Removed the accordion expansion
   (no chevron, no expandable content) and went straight to the
   category. Visual stripping: the .menu-accordion--direct gets the
   exact same row treatment as the accordion trigger, just acts as
   an anchor and carries an .is-active state when the customer is
   on its target category. */
.menu-accordion__trigger--link {
    text-decoration: none;
}
.menu-accordion__trigger--link.is-active {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    box-shadow: inset 3px 0 0 var(--color-primary);
    font-weight: 600;
}
.menu-accordion__trigger--link.is-active .menu-accordion__icon {
    color: var(--color-primary);
}

.menu-accordion__trigger:active {
    background: var(--color-bg-glass);
}

@media (hover: hover) {
    .menu-accordion__trigger:hover {
        background: var(--color-bg-glass);
    }
}

/* Icon */
.menu-accordion__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-primary);
    opacity: 0.8;
}

.menu-accordion__icon img,
.menu-accordion__icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Title */
.menu-accordion__title {
    flex: 1;
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Arrow */
.menu-accordion__arrow {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
}

.menu-accordion__trigger[aria-expanded="true"] .menu-accordion__arrow {
    transform: rotate(90deg);
    color: var(--color-primary);
}

/* ---- Accordion Content ---- */
.menu-accordion__content {
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    max-height: 0;
    opacity: 0;
}

.menu-accordion__content[hidden] {
    display: block !important;
    max-height: 0;
    opacity: 0;
}

.menu-accordion__content.is-open {
    opacity: 1;
}

/* Category items */
.menu-accordion__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-lg) 10px calc(var(--space-lg) + 4px + var(--space-md));
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.menu-accordion__item:active {
    color: var(--color-primary);
    background: var(--color-bg-glass);
}

@media (hover: hover) {
    .menu-accordion__item:hover {
        color: var(--color-primary);
        background: var(--color-bg-glass);
    }
}

.menu-accordion__dot {
    width: 5px;
    height: 5px;
    border-radius: var(--radius-full);
    background: var(--color-text-muted);
    flex-shrink: 0;
    transition: background var(--transition-fast);
}

/* Optional inline SVG icon shown next to a category name when the
   operator picked one from the icon library. Sized to occupy roughly
   the same horizontal slot as .menu-accordion__dot would, so rows
   with and without an icon align cleanly along the left gutter. */
.menu-accordion__item-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.menu-accordion__item-icon svg {
    width: 100%;
    height: 100%;
}
.menu-accordion__item:hover .menu-accordion__item-icon,
.menu-accordion__item:active .menu-accordion__item-icon {
    color: var(--color-primary);
}

/* When the SVG markup has had its color codes stripped (paths with NO
   `fill` attribute), browsers fall back to the SVG default — solid
   black — so the icon ignores the container's `color`. Force-fill
   those uncoloured shapes with `currentColor` so they inherit the
   container's tenant primary. Shapes that DO declare a fill keep it,
   and stroke-only feather icons (fill="none" + stroke="currentColor")
   are matched by [fill] and left alone. */
.menu-accordion__icon svg :where(path, circle, rect, polygon, polyline, ellipse, line):not([fill]),
.menu-accordion__item-icon svg :where(path, circle, rect, polygon, polyline, ellipse, line):not([fill]) {
    fill: currentColor;
}

.menu-accordion__item:hover .menu-accordion__dot,
.menu-accordion__item:active .menu-accordion__dot {
    background: var(--color-primary);
}

/* Active item — JS adds `.is-active` to the menu item that matches
   the page the customer is currently on (category page, or the
   product detail's parent category). Tinted bar + primary-tinted
   text reads as "you are here" without needing a label. */
.menu-accordion__item.is-active {
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    box-shadow: inset 3px 0 0 var(--color-primary);
    font-weight: 600;
}
.menu-accordion__item.is-active .menu-accordion__dot,
.menu-accordion__item.is-active .menu-accordion__item-icon {
    color: var(--color-primary);
    background: var(--color-primary);
}
.menu-accordion__item.is-active .menu-accordion__item-icon {
    background: transparent;
}

/* ---- Featured Products (carousel, anchored at panel bottom) ----
   Sibling to `.menu-panel__scroll`, not a child of it — so the
   scroll above can grow / overflow without ever shifting this rail
   off-screen. `flex-shrink:0` is the lock that keeps it at its
   natural height regardless of the accordion content height. */
.menu-panel__featured {
    flex-shrink: 0;
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.menu-panel__featured-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 var(--space-lg) var(--space-sm);
}

.menu-panel__featured-scroll {
    display: flex;
    gap: 8px;
    padding: 0 var(--space-lg);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.menu-panel__featured-scroll::-webkit-scrollbar { display: none; }

/* Yatay kart: gorsel solda, bilgi sagda - 2 kart gorunur */
.menu-panel__featured-card {
    flex-shrink: 0;
    width: calc(50% - 4px);
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    /* Hairline border — keeps the "Önerilen Ürünler" cards here
       consistent with the search modal's featured list. */
    border: 1px solid var(--color-border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: background var(--transition-fast);
}

body.theme-light .menu-panel__featured-card {
    background: #f5f5f5;
}

body:not(.theme-light) .menu-panel__featured-card {
    background: var(--color-bg-glass);
}

.menu-panel__featured-card:active {
    opacity: 0.8;
}

.menu-panel__featured-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-bg-glass-strong);
}

.menu-panel__featured-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu-panel__featured-info {
    flex: 1;
    min-width: 0;
}

.menu-panel__featured-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-panel__featured-price {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 2px;
}
