/**
 * theme.css — photoZseo storefront ortak tasarım sistemi (P-design-unify Faz 0).
 *
 * Tek kaynak: store (/store/*) ve market (/market/*) sayfalarının paylaştığı
 * renk paleti, tipografi ve spacing token'ları. renderDocument her iki sistemde
 * de bu dosyayı İLK stylesheet olarak yükler; storefront.css ve marketplace.css
 * yalnızca bu token'lara referans verir.
 *
 * Faz 1'de iki sayfa CSS'i hardcoded hex'leri token'larla değiştirir; o noktada
 * dark mode store'da da tam çalışır.
 */

:root {
  /* ── Renk — açık tema ─────────────────────────────────────────────── */
  --bg:          #E8E8EC;   /* sayfa zemini */
  --bg-page:     #F5F5F7;   /* store gibi daha yumuşak zemin gerektiğinde */
  --fg:          #1D1D1F;   /* ana metin */
  --muted:       #6E6E73;   /* ikincil metin */
  --dim:         #86868B;   /* üçüncül / ipucu metin */
  --line:        #E5E5EA;   /* kenarlık / ayraç */
  --line-strong: #D2D2D7;   /* belirgin kenarlık */
  --card:        #FFFFFF;   /* kart zemini */
  --input:       #F2F2F7;   /* form alanı zemini */

  /* Accent — storefront standardı (mavi). Onaylı karar: #4361EE. */
  --accent:      #4361EE;
  --accent-hover:#3451D1;
  --on-accent:   #FFFFFF;

  /* WhatsApp eylem rengi (storefront butonları) */
  --wa:          #25D366;
  --wa-hover:    #1DA851;

  /* Durum rozetleri / stok p+ sipariş durumları */
  --badge-low:   #FF6B35;
  --badge-in:    #34C759;
  --badge-out:   #8E8E93;
  --ok-bg:       #D1FAE5;  --ok-fg:   #065F46;
  --warn-bg:     #FEF3C7;  --warn-fg: #92400E;
  --err-bg:      #FEE2E2;  --err-fg:  #991B1B;

  /* ── Tipografi ────────────────────────────────────────────────────── */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --fs-xs:   0.78rem;
  --fs-sm:   0.85rem;
  --fs-base: 0.95rem;
  --fs-md:   1.05rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.7rem;
  --fs-2xl:  2.4rem;

  --lh-tight: 1.12;
  --lh-base:  1.5;

  /* ── Spacing (4px tabanlı ölçek) ──────────────────────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 72px;

  /* ── Şekil ────────────────────────────────────────────────────────── */
  --radius:      16px;
  --radius-sm:   10px;
  --radius-pill: 999px;

  --shadow:    0 2px 12px rgba(0, 0, 0, 0.07);
  --shadow-h:  0 8px 28px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);

  /* ── Layout ───────────────────────────────────────────────────────── */
  --maxw:     1160px;
  --header-h: 56px;   /* sticky üst header sabit yüksekliği (zıplama önleme) */
  --tab-h:    60px;   /* mobil alt tab bar yüksekliği (market) */
}

/* ── Dark mode — store + market ortak ───────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0B0B0D;   /* saf siyah yerine yumuşak near-black (OLED'de daha az sert) */
    --bg-page:     #141416;
    --fg:          #F5F5F7;
    --muted:       #98989F;
    --dim:         #8E8E93;
    --line:        #2C2C2E;
    --line-strong: #3A3A3C;
    --card:        #1C1C1E;
    --input:       #2C2C2E;

    --ok-bg:   rgba(52, 199, 89, 0.16);  --ok-fg:   #34C759;
    --warn-bg: rgba(255, 159, 10, 0.16); --warn-fg: #FF9F0A;
    --err-bg:  rgba(255, 69, 58, 0.16);  --err-fg:  #FF453A;

    --shadow:    0 2px 12px rgba(0, 0, 0, 0.45);
    --shadow-h:  0 8px 28px rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.4);
  }
}

/* ── Temel reset — body zemini/tipografisi her iki storefront için ──── */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Sayfa geçişlerinde scrollbar var/yok zıplamasını önler. */
  scrollbar-gutter: stable;
}

*, *::before, *::after { box-sizing: border-box; }

img { max-width: 100%; }

/* ════════════════════════════════════════════════════════════════════
   ORTAK KABUK — store + market sticky üst header, hesap, sepet, footer
   (app-shell.ts tarafından üretilir). Tüm storefront sayfalarında birebir.
   ════════════════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  width: 100%;
  max-width: var(--maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.app-brand__mark { width: 26px; height: 26px; border-radius: 7px; display: block; }
.app-brand__name { letter-spacing: -0.01em; }
.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-inline-start: auto;
  min-width: 0;
}
.app-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--fg);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.app-cart:hover { background: var(--input); }
.app-cart__badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Hesap widget (auth.js pz-* ID'lerine bağlı; class'lar ortak) */
.app-acct { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.app-acct__signin { display: flex; align-items: center; min-height: 40px; } /* GIS buton render'ında zıplamayı önle */
.app-acct__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px 6px 9px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.app-acct__btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.10); }
.app-acct__btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app-acct__glogo { flex-shrink: 0; display: block; }
.app-acct__btn-label { line-height: 1; }
.app-acct__user { display: flex; align-items: center; }

/* Header içindeki store kontrolleri (para birimi + dil) — sade, etiketsiz.
   Select'in içeriği (English / USD) zaten açıklayıcı; aria-label erişilebilirliği
   korur. Kur notu header'ı sarmasın diye gizli (fiyattaki ≈ dönüşümü belirtir). */
.app-header .sf-controls { margin: 0; gap: var(--sp-2); align-items: center; flex-wrap: nowrap; }
.app-header .sf-control { flex-direction: row; gap: 0; }
.app-header .sf-control__label { display: none; }
.app-header .sf-rate-note { display: none; }

/* Dar ekran: marka adı gizlenir (logo kalır), etiketler daralır */
@media (max-width: 520px) {
  .app-brand__name { display: none; }
  .app-acct__btn-label { display: none; }
  .app-acct__btn { padding: 8px; }
  .app-header__inner { gap: var(--sp-2); padding: 0 var(--sp-3); }
  .app-header__actions { gap: 6px; }
  .app-header .sf-select { padding: 6px 22px 6px 9px; font-size: 0.8rem; }
  .app-cart { width: 36px; height: 36px; }
}

/* Ortak footer */
.app-footer {
  max-width: var(--maxw);
  margin: var(--sp-7) auto 0;
  padding: var(--sp-5) var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.app-footer__trust { margin: 0 0 var(--sp-2); color: var(--dim); }
.app-footer__links { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; justify-content: center; }
.app-footer a { color: var(--muted); text-decoration: none; }
.app-footer a:hover { color: var(--fg); text-decoration: underline; }
.app-footer__brand { font-weight: 600; }
.app-footer__sep { margin: 0 var(--sp-2); color: var(--line-strong); }

/* Sticky üst header varken sayfa-içi sticky araç çubuğu header altına yapışır */
.app-has-header .sf-toolbar { top: var(--header-h); }

/* ── Ortak boş durum (Sonuç Bulunamadı / Sepetiniz Boş) ─────────────── */
.app-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-3);
  max-width: 360px;
  margin: var(--sp-7) auto;
  padding: var(--sp-6) var(--sp-4);
}
.app-empty__icon {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--input);
  color: var(--dim);
  font-size: 2.6rem;
  line-height: 1;
}
.app-empty__title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.app-empty__subtitle {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--muted);
  line-height: 1.5;
}
.app-empty__cta {
  margin-top: var(--sp-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: var(--fs-base);
  text-decoration: none;
  transition: background 0.15s ease;
}
.app-empty__cta:hover { background: var(--accent-hover); }
