/* =============================================================================
   Esnafhan vitrini — statik PWA (docs/SIPARIS-TAKIBI.md §23).
   Mobil önce. Kütüphane/web fontu yok: tüketici uygulamasında ilk açılış süresi ciroyu keser.

   ⚠ Görünürlük el.hidden ile yönetilir → [hidden] kuralı ŞART: .sheet'in display:flex
   tarayıcı kuralını ezer, yoksa "gizli" katman her dokunuşu yutar (mağaza sayfasında
   yaşandı — §14.2).

   Renkler Esnafhan logosundan (lacivert + turuncu + yeşil) ve tanıtım sitesiyle AYNI
   (Site/src/styles/global.css). Koda renk gömülmez, değişken kullanılır: karanlık tema
   yalnız aşağıdaki değişken bloğunu değiştirir (§23.14).
   ============================================================================= */
[hidden] { display: none !important; }

:root {
    color-scheme: light dark;

    --navy: #13285E;
    --navyDeep: #0B1B41;
    --orange: #FF4A14;          /* ikon/vurgu */
    --brand: #E63C0A;           /* üstünde YAZI olan turuncu: beyaz yazı okunur kalsın */
    --brandInk: #FFFFFF;

    --bg: #F5F7FB;
    --card: #FFFFFF;
    --ink: #0B1324;
    --muted: #4B5870;
    --line: #E3E8F1;
    --link: #1D3A80;

    --promoBg: #FFF2ED;  --promoLine: #FFD3C2;  --promoInk: #B8320A;
    --okBg: #DCFCE7;     --okLine: #BBF7D0;     --okInk: #166534;
    --warnBg: #FEF3C7;   --warnLine: #FDE68A;   --warnInk: #92400E;
    --star: #F59E0B;

    --radius: 16px;
    --shadow: 0 1px 2px rgba(11, 27, 65, .04), 0 6px 18px rgba(11, 27, 65, .07);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0A1226;
        --card: #131D38;
        --ink: #E8EDF7;
        --muted: #9AA8C2;
        --line: #26335A;
        --link: #9DB8FF;
        --brand: #F04A1A;

        --promoBg: rgba(255, 74, 20, .14);  --promoLine: rgba(255, 74, 20, .38);  --promoInk: #FF9A78;
        --okBg: rgba(22, 163, 74, .16);     --okLine: rgba(22, 163, 74, .40);     --okInk: #86EFAC;
        --warnBg: rgba(245, 158, 11, .14);  --warnLine: rgba(245, 158, 11, .40);  --warnInk: #FCD34D;

        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
}

h1, h2 { letter-spacing: -0.02em; line-height: 1.2; }

.ic {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------------- Üst çubuk ---------------- */

.top {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px 16px;
    background: linear-gradient(135deg, var(--navyDeep), var(--navy));
    color: #FFFFFF;
}

.topIn { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.brandBox { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* Sembolün iğnesi laciverttir → lacivert çubukta kaybolmasın diye beyaz karoda durur. */
.brandMark {
    width: 38px;
    height: 38px;
    padding: 3px;
    border-radius: 11px;
    background: #FFFFFF;
    object-fit: contain;
}

.brand { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.brandHint { font-size: 12px; color: rgba(255, 255, 255, .72); }

.area {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 55%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #FFFFFF;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
}

.area .ic { width: 16px; height: 16px; color: #FF8A5F; }
.area span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding: 0 16px; }

/* ---------------- Karşılama (§23.14) ---------------- */

.welcome { padding-top: 16px; }

.hero {
    padding: 22px 18px;
    border-radius: 22px;
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(255, 74, 20, .28), transparent 60%),
        linear-gradient(150deg, var(--navyDeep), var(--navy));
    color: #FFFFFF;
    box-shadow: var(--shadow);
}

.hero h1 { margin: 0 0 8px 0; font-size: 27px; font-weight: 800; }
.hero p { margin: 0 0 18px 0; color: rgba(255, 255, 255, .82); }

.steps { list-style: none; margin: 14px 0 0 0; padding: 0; display: grid; gap: 8px; }

.steps li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}

.steps b { display: block; }
.steps span { color: var(--muted); font-size: 14px; }

.stepIcon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--promoBg);
}

.steps .stepIcon .ic { width: 22px; height: 22px; color: var(--orange); }

.trust { list-style: none; margin: 14px 0 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.trust li { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; color: var(--muted); }
.trust .ic { width: 16px; height: 16px; stroke-width: 3; color: var(--okInk); }

/* ---------------- Arama + eylemler ---------------- */

.searchRow { padding: 14px 0 4px 0; }

#search {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7890' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 13px center / 20px no-repeat;
    color: var(--ink);
    font: inherit;
    box-shadow: var(--shadow);
}

#search:focus, .field input:focus, .field select:focus, .rateBox textarea:focus {
    outline: 2px solid var(--orange);
    outline-offset: 1px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .12s ease, background-color .12s ease;
}

.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }

.btn.primary {
    width: 100%;
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brandInk);
    font-weight: 700;
}

.btn.big { padding: 14px 16px; font-size: 17px; box-shadow: 0 8px 20px rgba(230, 60, 10, .35); }

/* Lacivert zemin üstünde ikincil düğme (karşılama). */
.btn.ghost {
    width: 100%;
    margin-top: 8px;
    background: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .24);
    color: #FFFFFF;
}

.actionRow { display: flex; gap: 8px; margin-top: 8px; }
.actionRow .btn { white-space: nowrap; }
.actionRow .btn .ic { color: var(--orange); }
.btn.nearby { flex: 1 1 auto; }

.actionRow .btn[data-on="true"] { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }
.actionRow .btn[data-on="true"] .ic { color: #FF8A5F; }

/* ---------------- Kategori çipleri + liste bilgisi ---------------- */

.chips {
    display: flex;
    gap: 8px;
    margin: 12px -16px 0 -16px;
    padding: 0 16px 2px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
}

.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }

.listInfo { margin: 12px 2px 0 2px; color: var(--muted); font-size: 13px; }

/* ---------------- Mağaza kartı ---------------- */

.list { display: grid; gap: 10px; padding: 10px 0 12px 0; }

.store {
    position: relative;
    display: flex;
    gap: 12px;
    /* Üstten hiza: iki sütunlu düzende kısa kartın yazısı ortalanınca logodan kopuyordu. */
    align-items: flex-start;
    padding: 12px 34px 12px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform .12s ease;
}

.store:active { transform: scale(.985); }

/* Sağdaki ok: kartın dokunulabilir olduğunu söyler. */
.store::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--muted);
    border-top: 2px solid var(--muted);
    transform: translateY(-50%) rotate(45deg);
    opacity: .55;
}

/* Mağaza logoları saydam olabilir → iki temada da beyaz zeminde dursun. */
.logo {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 14px;
    object-fit: cover;
    background: #FFFFFF;
    border: 1px solid var(--line);
}

.logoFallback {
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 24px;
    color: #FFFFFF;
    background: var(--navy);
    /* Karanlık temada lacivert karo lacivert kartta erimesin. */
    border: 1px solid rgba(255, 255, 255, .14);
}

.storeBody { min-width: 0; flex: 1 1 auto; }
.storeName { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; }

.storeLine {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.badge {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}

.badge.free { background: var(--okBg); border-color: var(--okLine); color: var(--okInk); font-weight: 600; }

/* Kampanya rozeti — bilgi rozetlerinden AYRI, marka turuncusunda (§23.10): "indirim var" bir bakışta görünmeli. */
.badge.promo { background: var(--promoBg); border-color: var(--promoLine); color: var(--promoInk); font-weight: 700; }

/* Puan rozeti: bir bakışta "kaç yıldız" okunmalı. */
.badge.rate { background: var(--warnBg); border-color: var(--warnLine); color: var(--warnInk); font-weight: 700; }
.badge.dist { background: var(--card); }

/* "Sana teslimat yok, ama gel al" kovası — kart yanlış beklenti yaratmamalı. */
.pickupOnly { color: var(--warnInk); font-size: 13px; margin-top: 4px; }

/* Yüklenirken iskelet kart: boş ekran "bozuk" izlenimi verir. */
.skeleton {
    height: 90px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: linear-gradient(100deg, var(--card) 30%, var(--bg) 50%, var(--card) 70%) 0 0 / 300% 100%;
    animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
    .btn, .store { transition: none; }
}

/* ---------------- Boş durum / notlar ---------------- */

.empty { padding: 28px 8px; text-align: center; }
.emptyTitle { font-weight: 700; margin: 0 0 6px 0; }
.emptyHint { color: var(--muted); margin: 0 0 14px 0; }
.offline { text-align: center; color: var(--muted); font-size: 14px; }

.emptyIcon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 12px auto;
    border-radius: 18px;
    background: var(--promoBg);
}

.emptyIcon .ic { width: 28px; height: 28px; color: var(--orange); }

/* ---------------- Esnaf çağrısı (§23.14) ---------------- */

.merchant {
    display: grid;
    gap: 12px;
    margin: 18px 0 8px 0;
    padding: 16px;
    border-radius: 20px;
    background: linear-gradient(150deg, var(--navyDeep), var(--navy));
    color: #FFFFFF;
    box-shadow: var(--shadow);
}

.merchantText b { display: block; font-size: 17px; letter-spacing: -0.01em; }
.merchantText span { color: rgba(255, 255, 255, .8); font-size: 14px; }

/* ---------------- Semt seçimi ---------------- */

.sheet {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    background: rgba(6, 14, 34, .55);
}

.sheetBox {
    width: 100%;
    max-height: 88vh;
    overflow: auto;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
    border-radius: 22px 22px 0 0;
    background: var(--card);
}

.sheetHead { display: flex; align-items: center; justify-content: space-between; font-size: 18px; }
.sheetHint { color: var(--muted); font-size: 14px; margin: 6px 0 14px 0; }

.linkBtn { border: 0; background: none; color: var(--link); font: inherit; font-size: 16px; font-weight: 600; padding: 6px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

.field select, .field input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    font: inherit;
}

/* ---------------- Alt gezinme ---------------- */

.bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom)) 12px;
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(11, 27, 65, .06);
}

.navBtn {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 8px 4px 6px 4px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
}

.navBtn .ic { width: 23px; height: 23px; }
.navBtn[aria-selected="true"] { color: var(--brand); }

.navBtn[aria-selected="true"]::before {
    content: "";
    position: absolute;
    top: -6px;
    width: 28px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--orange);
}

/* ---------------- Siparişlerim (§23.9) ---------------- */

.card {
    padding: 14px;
    margin: 12px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.note {
    margin: 0 0 10px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--warnBg);
    color: var(--warnInk);
    font-size: 14px;
}

.order { display: block; padding: 14px; }
.orderHead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.orderStore { font-weight: 700; }
.orderDate { color: var(--muted); font-size: 12px; white-space: nowrap; }
.orderStatus { margin-top: 8px; font-weight: 700; color: var(--brand); }
.orderStatus.done { color: var(--okInk); }
.orderNext { color: var(--muted); font-size: 14px; margin-top: 2px; }

.orderMeta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.orderActions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.orderActions .btn { padding: 8px 12px; font-size: 14px; }

/* ---------------- Puan (§23.11) ---------------- */

.stars { display: flex; gap: 4px; margin-top: 8px; }

.star {
    border: 0;
    background: none;
    padding: 2px 4px;
    font-size: 28px;
    line-height: 1;
    color: var(--line);
    cursor: pointer;
}

.star[data-on="true"] { color: var(--star); }

.rateBox { margin-top: 10px; }
.rateBox textarea {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--ink);
    font: inherit;
    resize: vertical;
}

.rateDone { margin-top: 8px; color: var(--okInk); font-size: 14px; font-weight: 600; }
.rateHint { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------------- Harita görünümü (§23.13) ---------------- */

#map {
    height: 62vh;
    min-height: 320px;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

#mapCard { margin-top: 10px; }

/* ---------------- Esnafhan sekmesi (§23.14) ---------------- */

.about h2 { margin: 0 0 8px 0; font-size: 18px; }
.about p { margin: 0 0 10px 0; color: var(--muted); }
.about p:last-child { margin-bottom: 0; }
.about .steps { margin-top: 0; }
.about .steps li { background: var(--bg); }

.logoPlate {
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 14px;
    background: #FFFFFF;
    border: 1px solid var(--line);
}

.logoPlate img { max-width: 100%; width: 230px; height: auto; }

.about details { border-top: 1px solid var(--line); }
.about details:first-of-type { border-top: 0; }

.about summary {
    position: relative;
    padding: 12px 26px 12px 0;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.about summary::-webkit-details-marker { display: none; }

.about summary::after {
    content: "";
    position: absolute;
    right: 6px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: translateY(-70%) rotate(45deg);
    transition: transform .15s ease;
}

.about details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.about details p { margin: 0 0 12px 0; font-size: 15px; }

.foot { text-align: center; margin: 16px 0 8px 0; font-size: 14px; }
.foot a { color: var(--link); font-weight: 600; }

/* ---------------- Geniş ekran ---------------- */

@media (min-width: 720px) {
    main { max-width: 960px; margin-inline: auto; }
    /* main'in 16px iç boşluğu genişliğe dahildir → üst çubuk içeriği aynı hizaya 928 ile gelir. */
    .topIn { max-width: 928px; margin-inline: auto; }
    .list { grid-template-columns: 1fr 1fr; }
    .welcome { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0 20px; align-items: start; }
    .hero { grid-row: span 2; padding: 34px 28px; }
    .hero h1 { font-size: 36px; }
    .steps { margin-top: 0; }
    .merchant { grid-template-columns: 1fr auto; align-items: center; padding: 20px 24px; }
    .merchant .btn.primary { width: auto; }
    #viewAbout, #viewOrders { max-width: 640px; }
    .sheet { align-items: center; justify-content: center; }
    .sheetBox { max-width: 460px; border-radius: 22px; }
    .bottom { grid-template-columns: repeat(3, minmax(0, 170px)); justify-content: center; }
}
