/* ==========================================================================
   MATERYAL — Material 3 (dm-tema F8)
   Tonal yüzeyler, M3 filter çipleri (aktifte onay işareti), uzatılmış FAB sepet.
   Vurgu: --m3-primary = --theme-color-1 (varsayılan M3 eflatunu).
   ========================================================================== */
:root {
    --m3-bg: #FDF8FD;
    --m3-surface: #F6F0F7;
    --m3-surface-hi: #FFFFFF;
    --m3-ink: #1D1B20;
    --m3-muted: #49454F;
    --m3-outline: #CAC4D0;
    --m3-primary: var(--theme-color-1, #6750A4);
    --m3-primary-soft: var(--theme-color-0_12, rgba(103, 80, 164, .12));
}

html, body { background: var(--m3-bg); }
body {
    margin: 0; color: var(--m3-ink);
    font-family: 'Roboto', -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}
body.noscroll { overflow: hidden; }

.overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(29, 27, 32, .4);
    opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.active { opacity: 1; pointer-events: auto; }

/* --- Üst uygulama çubuğu --- */
.m3-appbar {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--m3-bg);
}
.m3-logo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.m3-appbar-txt { flex: 1 1 auto; min-width: 0; }
.m3-appbar-txt h1 {
    margin: 0; font-size: 20px; font-weight: 500; letter-spacing: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m3-appbar-txt p {
    margin: 1px 0 0; color: var(--m3-muted); font-size: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m3-iconbtn {
    flex: 0 0 auto; min-width: 40px; height: 40px; border-radius: 999px; cursor: pointer;
    background: transparent; color: var(--m3-muted); border: 0; font-size: 17px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
    transition: background .2s;
}
.m3-iconbtn:hover, .m3-iconbtn:active { background: var(--m3-primary-soft); color: var(--m3-primary); }
.m3-lang-btn { font-size: 13px; font-weight: 500; }

/* dil menüsü (M3 menu) */
.m3-lang { position: relative; }
.m3-lang-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 960;
    left: auto; max-width: calc(100vw - 24px);
    background: var(--m3-surface-hi); border-radius: 12px;
    min-width: 150px; padding: 8px 0;
    box-shadow: 0 4px 8px rgba(0,0,0,.12), 0 12px 28px rgba(0,0,0,.14);
}
.m3-lang-menu.show { display: block; }
.m3-lang-menu .dropdown-item {
    display: block; padding: 11px 16px; color: var(--m3-ink); text-decoration: none;
    font-size: 14px;
}
.m3-lang-menu .dropdown-item:hover { background: var(--m3-primary-soft); }

/* --- Arama (M3 search bar) --- */
.m3-search-row { padding: 4px 16px 8px; max-width: 680px; margin: 0 auto; }
.m3-search-row input {
    width: 100%; box-sizing: border-box;
    background: var(--m3-surface); border: 0; border-radius: 999px;
    padding: 14px 20px; font-size: 15px; color: var(--m3-ink); outline: none;
    font-family: inherit;
}
.m3-search-row input:focus { box-shadow: 0 0 0 2px var(--m3-primary); }

/* --- Filter çipleri --- */
.m3-chips {
    position: sticky; top: 0; z-index: 500;
    display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding: 10px 16px 12px;
    background: linear-gradient(180deg, var(--m3-bg) 82%, transparent);
}
.m3-chips::-webkit-scrollbar { display: none; }
.m3-chip {
    flex: 0 0 auto; cursor: pointer; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; color: var(--m3-muted);
    border: 1px solid var(--m3-outline); border-radius: 9px;
    padding: 8px 15px; font-family: inherit; font-size: 13.5px; font-weight: 500;
    transition: background .2s, border-color .2s, color .2s;
}
.m3-chip i { display: none; font-size: 13px; }
.m3-chip.active {
    background: var(--m3-primary-soft); border-color: transparent; color: var(--m3-primary);
    font-weight: 600;
}
.m3-chip.active i { display: inline-flex; }

/* --- Gövde / kartlar --- */
.m3-body { max-width: 680px; margin: 0 auto; padding: 2px 16px 130px; }
.m3-card {
    background: var(--m3-surface); border-radius: 20px;
    padding: 6px 16px; margin-bottom: 14px;
}
.m3-cat-title { font-size: 17px; font-weight: 500; margin: 14px 0 4px; }
.m3-subhead {
    font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--m3-primary); margin: 16px 0 2px;
}

/* --- Liste öğesi (M3 list item) --- */
.m3-item {
    display: flex; gap: 14px; align-items: center;
    padding: 12px 0; border-bottom: 1px solid rgba(202, 196, 208, .5);
}
.m3-item:last-child { border-bottom: 0; }
.m3-item-media { position: relative; flex: 0 0 56px; }
.m3-item-media img, .m3-item-noimg {
    width: 56px; height: 56px; border-radius: 12px; object-fit: cover; display: block;
}
.m3-item-noimg {
    display: flex; align-items: center; justify-content: center;
    background: var(--m3-primary-soft); color: var(--m3-primary); font-size: 19px;
}
.m3-item-type {
    position: absolute; top: -4px; left: -4px; width: 15px; height: 15px;
    background: var(--m3-surface-hi); border-radius: 5px;
    display: flex; align-items: center; justify-content: center; font-size: 5.5px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.m3-item-type.veg { color: #146C2E; }
.m3-item-type.nonveg { color: #B3261E; }
.m3-item-body { flex: 1 1 auto; min-width: 0; }
.m3-item-body h4 { margin: 0; font-size: 15px; font-weight: 500; }
.m3-item-desc {
    margin: 2px 0 0; color: var(--m3-muted); font-size: 12.5px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.m3-item-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.m3-kcal {
    border: 1px solid var(--m3-outline); color: var(--m3-muted);
    border-radius: 7px; padding: 2px 8px; font-size: 10.5px; font-weight: 500;
}
.m3-algs { display: inline-flex; gap: 4px; }
.m3-algs i {
    width: 19px; height: 19px; border-radius: 50%;
    background: var(--m3-surface-hi); color: var(--m3-muted);
    font-size: 8.5px; font-style: normal;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--m3-outline);
}
.m3-item-right {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end;
    justify-content: space-between; gap: 8px; align-self: stretch; padding: 2px 0;
}
.m3-item-price { font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.m3-add {
    width: 34px; height: 34px; border-radius: 12px; cursor: pointer;
    background: var(--m3-primary); color: var(--theme-on-accent, #fff); border: 0; font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: box-shadow .2s;
}
.m3-add:active { box-shadow: 0 3px 8px rgba(0,0,0,.3); }
.m3-no-result { text-align: center; color: var(--m3-muted); font-size: 14px; padding: 26px 0; }
.m3-brand { text-align: center; color: #AEA9B4; font-size: 11px; padding: 20px 0 0; }

/* --- Sepet: uzatılmış FAB --- */
.m3-cartbar {
    position: fixed; left: 16px; right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom)); z-index: 900;
}
.m3-cartbar.none { display: none; }
.m3-cartbar-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-height: 56px; cursor: pointer;
    background: var(--m3-primary); color: var(--theme-on-accent, #fff);
    border: 0; border-radius: 16px; padding: 0 20px;
    font-family: inherit; font-size: 14.5px; font-weight: 500;
    box-shadow: 0 3px 6px rgba(0,0,0,.2), 0 10px 24px var(--theme-color-0_3, rgba(103, 80, 164, .3));
}
.m3-cartbar-btn i { font-size: 17px; }
.m3-cartbar-count { opacity: .9; font-size: 12.5px; }
.m3-cartbar-price { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Servis (küçük FAB) --- */
.m3-servis {
    position: fixed; right: 16px; bottom: 90px; z-index: 890; cursor: pointer;
    background: var(--m3-surface-hi); color: var(--m3-ink);
    border: 0; border-radius: 14px;
    padding: 12px 18px; font-family: inherit; font-size: 13px; font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,.18), 0 8px 20px rgba(0,0,0,.12);
}

.dm-preview-bar { bottom: 90px !important; }

@media (min-width: 640px) {
    .m3-appbar, .m3-chips { max-width: 680px; margin-left: auto; margin-right: auto; }
    .m3-chips { flex-wrap: wrap; overflow-x: visible; }
    .m3-cartbar { left: 50%; right: auto; width: min(648px, calc(100vw - 32px)); transform: translateX(-50%); }
    .m3-servis { right: calc(50% - 324px - 16px); }
}

/* dm-tema F15: tema modu karşılığı (Koyu seçilirse) — varsayılan dışı görünüm */
body.dm-alt-dark {
    --m3-bg: #141218;
    --m3-surface: #1D1B20;
    --m3-surface-hi: #2B2930;
    --m3-ink: #E6E0E9;
    --m3-muted: #CAC4D0;
    --m3-outline: #49454F;
    background-color: #141218;
    --m3-primary: var(--theme-color-1, #6750A4);
    --m3-primary-soft: var(--theme-color-0_12, rgba(103, 80, 164, .12));
}
html:has(> body.dm-alt-dark) { background: #141218; }
body.dm-alt-dark .m3-item { border-bottom-color: rgba(202,196,208,.16); }
body.dm-alt-dark .m3-brand { color: var(--m3-muted); }
