/* ============================================
   Menu / Producten pagina
   Thuisbezorgd-style bestelpagina
   ============================================ */

/* ---- Header ---- */
.menu-header {
    background: var(--charcoal-dark);
    padding: 24px 0 20px;
    position: relative;
    overflow: hidden;
}

.menu-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(220,38,38,0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* ---- Zoekbalk ---- */
.search-wrap {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: rgba(255,255,255,0.3);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    color: white;
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition);
}

.search-input::placeholder {
    color: rgba(255,255,255,0.6); /* WCAG AA — was 0.3 (faalde contrast) */
}

.search-input:focus {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.15);
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.4);
    font-size: 1.3rem;
    line-height: 1;
    background: none;
    border: none;
    padding: 4px 6px;
}

.search-clear:hover {
    color: white;
}

/* ---- Sticky Category Bar ---- */
.category-bar {
    position: sticky;
    top: 84px;
    z-index: 35;
    background: white;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

@media (min-width: 640px) {
    .category-bar { top: 92px; }
}

@media (min-width: 1024px) {
    .category-bar { top: 100px; }
}

/* Zoek-knop in de sticky category-bar — scrollt naar boven + focust input */
.cat-bar-search-jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.08);
    color: var(--red);
    border: 1px solid transparent;
    transition: background 180ms ease, transform 160ms ease;
}

.cat-bar-search-jump:hover,
.cat-bar-search-jump:focus-visible {
    background: rgba(220, 38, 38, 0.16);
    transform: scale(1.06);
    outline: none;
}

.cat-bar-search-jump svg {
    width: 18px;
    height: 18px;
}

.category-bar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.category-pills-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.category-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

/* Op desktop reserveren we ruimte aan beide zijden voor de chevron-knoppen,
 * zodat de pills daar nooit onderdoor scrollen en alles klikbaar blijft. */
@media (min-width: 768px) {
    .category-pills {
        padding-left: 44px;
        padding-right: 44px;
    }
}

/* Fade-gradients aan de zijkanten — pills lopen soft uit i.p.v. abrupt afgeknipt */
.category-pills-wrap::before,
.category-pills-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 52px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 200ms ease;
}

.category-pills-wrap::before {
    left: 0;
    background: linear-gradient(to right, white 35%, rgba(255,255,255,0));
}

.category-pills-wrap::after {
    right: 0;
    background: linear-gradient(to left, white 35%, rgba(255,255,255,0));
}

.category-pills-wrap.can-scroll-left::before { opacity: 1; }
.category-pills-wrap.can-scroll-right::after { opacity: 1; }

/* Chevron-knoppen — zelfde rode stijl als de zoek-knop ernaast */
.pills-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.18);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--red);
    transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.pills-nav:hover,
.pills-nav:focus-visible {
    background: var(--red);
    color: white;
    border-color: var(--red);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.32);
    transform: translateY(-50%) scale(1.08);
    outline: none;
}

.pills-nav-prev { left: 2px; }
.pills-nav-next { right: 2px; }

.pills-nav svg {
    width: 14px;
    height: 14px;
}

@media (min-width: 768px) {
    .pills-nav { display: inline-flex; }
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    flex-shrink: 0;
    padding: 7px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    transition: all 150ms ease;
    white-space: nowrap;
}

.pill-default {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

.pill-default:hover {
    background: #EBEBEA;
    color: var(--text);
}

.pill-active {
    background: var(--charcoal-dark);
    color: white;
}

/* ---- Sort ---- */
.sort-wrap {
    flex-shrink: 0;
    padding: 10px 0;
    position: relative;
}

.sort-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 150ms ease;
    white-space: nowrap;
}

.sort-toggle:hover {
    border-color: #D6D3D1;
    color: var(--text);
}

.sort-toggle-open {
    border-color: var(--red);
    color: var(--text);
}

.sort-toggle-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sort-toggle-chevron {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    transition: transform 200ms ease;
    margin-left: 2px;
}

.sort-toggle-chevron.flipped {
    transform: rotate(180deg);
}

.sort-dropdown {
    position: absolute;
    top: calc(100% - 2px);
    right: 0;
    min-width: 200px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    padding: 6px;
    overflow: hidden;
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 150ms ease;
    text-align: left;
}

.sort-option:hover {
    background: var(--bg-gray);
    color: var(--text);
}

.sort-option-active {
    background: var(--red-light);
    color: var(--red);
    font-weight: 700;
}

.sort-option-active:hover {
    background: var(--red-light);
    color: var(--red);
}

.sort-option svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---- Sectie headers ---- */
.menu-section {
    margin-bottom: 28px;
    /* scroll-margin = navbar + category-bar + ademruimte. Responsive zodat
       de sectie/het product altijd net onder de sticky balken eindigt, op
       elk device. Werkt voor scrollIntoView én anchor-hash navigatie. */
    scroll-margin-top: 158px;
}

.product-card {
    scroll-margin-top: 158px;
}

@media (min-width: 640px) {
    .menu-section,
    .product-card { scroll-margin-top: 168px; }
}

@media (min-width: 1024px) {
    .menu-section,
    .product-card { scroll-margin-top: 178px; }
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--charcoal-dark);
}

.section-title {
    font-family: var(--font);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}

.section-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---- Product Grid ---- */
.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* ---- Product Card ---- */
.product-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 150ms ease, box-shadow 150ms ease;
    position: relative;
    overflow: hidden;
}

/* Korting badge */
.product-korting-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--red);
    color: white;
    font-family: var(--font);
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 0 11px 0 8px;
    z-index: 3;
}

.product-card:hover {
    border-color: #D6D3D1;
    box-shadow: var(--shadow-sm);
}

.product-card.out-of-stock {
    opacity: 0.55;
}

/* Hidden bij filter — display:none zodat de grid herflowed. */
.product-card.is-hidden {
    display: none;
}

/* "Bedoel je soms?" banner — geel/amber accent, lightbulb pulse */
.suggestion-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: linear-gradient(90deg, rgba(252, 211, 77, 0.18) 0%, rgba(252, 211, 77, 0.04) 100%);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #78350f;
    line-height: 1.4;
}
.suggestion-banner svg {
    width: 20px;
    height: 20px;
    color: #f59e0b;
    flex-shrink: 0;
    animation: shop-bulb-pulse 1.6s ease-in-out infinite;
}
.suggestion-banner strong {
    color: #b91c1c;
    font-weight: 700;
}
@keyframes shop-bulb-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.12); opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
    .suggestion-banner svg { animation: none; }
}

.product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-name:hover {
    color: var(--red);
}

.product-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-bottom {
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.product-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-price {
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text);
}

.product-price-old {
    font-size: 0.78rem;
    color: var(--red);
    text-decoration: line-through;
}

.sale-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--red);
    background: var(--red-light);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ---- Product Image ---- */
.product-img-wrap {
    flex-shrink: 0;
    width: 90px;
    height: 90px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-gray);
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 300ms ease;
    padding: 4px;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--charcoal-dark);
}

.product-img-logo {
    max-width: 65%;
    max-height: 65%;
    object-fit: contain;
    opacity: 0.35;
    filter: brightness(0) invert(1);
}

@media (min-width: 640px) {
    .product-img-wrap {
        width: 100px;
        height: 100px;
    }
}

/* ---- Add to cart button ---- */
.add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 14px;
    background: var(--red);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    transition: all 150ms ease;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 34px;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.add-btn:hover:not(:disabled) {
    background: var(--red-dark);
}

.add-btn:disabled {
    cursor: wait;
}

.add-btn:not(:disabled) {
    cursor: pointer !important;
}

.add-btn-done {
    background: var(--green) !important;
}

.add-label {
    display: none;
}

@media (min-width: 640px) {
    .add-label {
        display: inline;
    }
}

/* ---- Spinner ---- */
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Sold out ---- */
.sold-out {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 7px 12px;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 64px 20px;
}

/* ---- Page background ---- */
.menu-page {
    background: #F7F7F7;
    min-height: 100vh;
}

/* ---- Reduced motion ---- */
/* ---- Small mobile: compact sort ---- */
@media (max-width: 400px) {
    .sort-toggle {
        padding: 7px 8px;
        gap: 4px;
        font-size: 0.75rem;
    }

    .sort-toggle-chevron {
        display: none;
    }

    .pill {
        padding: 7px 12px;
        font-size: 0.78rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-img,
    .pill,
    .add-btn,
    .product-card {
        transition: none !important;
    }
    .btn-spinner {
        animation: none;
    }
}

/* ============================================================
   FOCUS-HIGHLIGHT — product card knippert kort wanneer
   gebruiker via search-dropdown naar /producten#product-{slug} navigeert
   ============================================================ */
.product-card--focus {
    animation: product-focus-pulse 700ms ease-in-out 4;
    position: relative;
    z-index: 1;
}

@keyframes product-focus-pulse {
    0%, 100% {
        background-color: #ffffff;
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
        transform: scale(1);
    }
    50% {
        background-color: #FEF2F2;
        box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18),
                    0 12px 32px rgba(220, 38, 38, 0.22);
        transform: scale(1.02);
    }
}

@media (prefers-reduced-motion: reduce) {
    .product-card--focus {
        animation: none;
        background-color: #FEF2F2;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
    }
}

/* Highlight wanneer gebruiker via category-pill op home naar /producten#cat-{slug} navigeert */
.menu-section--focus .section-title {
    animation: section-focus-pulse 600ms ease-in-out 3;
}
.menu-section--focus .section-header {
    animation: section-focus-border 600ms ease-in-out 3;
}

@keyframes section-focus-pulse {
    0%, 100% { color: inherit; transform: translateX(0); }
    50% { color: #DC2626; transform: translateX(4px); }
}

@keyframes section-focus-border {
    0%, 100% { border-bottom-color: var(--charcoal-dark); box-shadow: 0 0 0 rgba(220, 38, 38, 0); }
    50% { border-bottom-color: #DC2626; box-shadow: 0 2px 0 rgba(220, 38, 38, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
    .menu-section--focus .section-title,
    .menu-section--focus .section-header { animation: none; }
    .menu-section--focus .section-title { color: #DC2626; }
    .menu-section--focus .section-header { border-bottom-color: #DC2626; }
}
