/* ============================================================
   TASARIM TOKENLARI
   Palet: soğuk açık gri zemin + nane yeşili (mint) ana vurgu +
   sıcak altın (kampanya) ikincil vurgu. Fintech güven hissi.
   Tipografi: sistem fontu (-apple-system) -> gerçek iOS hissi.
   İmza öğesi: buzlu cam (frosted glass) alt menü + kayan
   "genie" bottom sheet detay kartı.
   ============================================================ */
:root {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.70);
  --ink: #12181F;
  --ink-soft: #6B7480;
  --ink-faint: #9AA3AE;
  --accent: #06B6A0;
  --accent-deep: #049085;
  --accent-soft: rgba(6, 182, 160, 0.12);
  --gold: #F2A705;
  --gold-soft: rgba(242, 167, 5, 0.14);
  --danger: #E0483E;
  --danger-soft: rgba(224, 72, 62, 0.12);
  --border: rgba(18, 24, 31, 0.08);
  --shadow: 0 10px 30px rgba(18, 24, 31, 0.08);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ---------- ÜST BAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  padding-top: calc(var(--safe-top) + 10px);
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 10px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-weight: 700; font-size: 15px;
}
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.icon-btn { position: relative; font-size: 19px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; transition: background .15s; }
.icon-btn:active { background: var(--border); }
.badge-dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.search-pill {
  margin: 2px 16px 10px; height: 40px; border-radius: 12px;
  background: rgba(18,24,31,0.05); display: flex; align-items: center; gap: 8px; padding: 0 12px;
  transition: transform .15s;
}
.search-pill:active { transform: scale(0.98); }
.search-pill input { border: none; background: none; outline: none; color: var(--ink-soft); font-size: 15px; width: 100%; }

.chip-row { display: flex; gap: 8px; padding: 0 16px 12px; overflow-x: auto; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-soft); transition: all .15s;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip:active { transform: scale(0.95); }

/* ---------- PULL TO REFRESH ---------- */
.pull-indicator {
  position: fixed; top: calc(var(--safe-top) + 6px); left: 0; right: 0; text-align: center;
  font-size: 13px; color: var(--ink-faint); z-index: 30; opacity: 0; transition: opacity .2s;
  pointer-events: none;
}
.pull-indicator.show { opacity: 1; }

/* ---------- ANA İÇERİK / VIEWS ---------- */
#app { padding: 4px 16px calc(96px + var(--safe-bottom)); min-height: 70vh; }
.view { display: none; animation: fadeIn .28s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.masonry, .list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.list { grid-template-columns: 1fr; }

/* ---------- TEKLİF KARTI ---------- */
.offer-card {
  background: var(--surface); border-radius: var(--radius-md); padding: 12px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s, box-shadow .15s;
  animation: cardIn .35s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.offer-card:active { transform: scale(0.96); box-shadow: 0 4px 12px rgba(18,24,31,0.08); }
.list .offer-card { flex-direction: row; align-items: center; }

.offer-card-top { display: flex; align-items: center; justify-content: space-between; }
.offer-logo {
  width: 44px; height: 44px; border-radius: 12px; background: var(--bg);
  display: grid; place-items: center; font-weight: 700; font-size: 16px; color: var(--accent-deep);
  overflow: hidden; flex: none;
}
.offer-logo img { width: 100%; height: 100%; object-fit: cover; }
.fav-heart { font-size: 20px; transition: transform .2s; }
.fav-heart.active { transform: scale(1.15); }
.fav-heart:active { transform: scale(0.8); }

.offer-body { flex: 1; min-width: 0; }
.offer-name { font-size: 15px; font-weight: 700; margin: 0 0 2px; }
.offer-cat { font-size: 12px; color: var(--ink-faint); margin: 0 0 4px; }
.offer-desc { font-size: 12.5px; color: var(--ink-soft); margin: 0; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-deep);
}
.tag.gold { background: var(--gold-soft); color: #8a5f04; }

.offer-meta { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--ink-faint); }
.offer-actions { display: flex; gap: 8px; margin-top: 4px; }
.btn-review {
  flex: 1; text-align: center; padding: 9px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700;
  background: var(--ink); color: #fff; transition: transform .12s;
}
.btn-review:active { transform: scale(0.96); }

/* ---------- SKELETON LOADING ---------- */
.skeleton-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.skeleton-card { height: 168px; border-radius: var(--radius-md); background: linear-gradient(100deg, #ECEFF3 30%, #F7F8FA 50%, #ECEFF3 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- BOŞ / SONA GELDİ DURUMLARI ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 6px; font-size: 17px; color: var(--ink); }
.empty-state p { margin: 0 0 16px; font-size: 13.5px; }
.end-msg { text-align: center; padding: 20px; color: var(--ink-faint); font-size: 13px; }

/* ---------- ALT MENÜ ---------- */
.bottom-nav {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-bottom));
  height: 64px; border-radius: 24px; z-index: 50;
  background: var(--surface-glass); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border); box-shadow: 0 12px 32px rgba(18,24,31,0.14);
  display: flex; align-items: stretch;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint); z-index: 2; transition: color .2s, transform .2s;
}
.nav-item .nav-icon { font-size: 20px; transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.nav-item.active { color: var(--accent-deep); }
.nav-item.active .nav-icon { transform: translateY(-2px) scale(1.12); }
.nav-item:active { transform: scale(0.92); }
.nav-indicator {
  position: absolute; top: 8px; width: calc(25% - 12px); height: 48px; border-radius: 16px;
  background: var(--accent-soft); transition: transform .35s cubic-bezier(.34,1.56,.64,1); z-index: 1;
}

/* ---------- ARAMA OVERLAY ---------- */
.search-overlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 90;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.94,.6,1);
  display: flex; flex-direction: column;
}
.search-overlay.open { transform: translateY(0); }
.search-overlay-top { display: flex; gap: 10px; align-items: center; padding: calc(var(--safe-top) + 14px) 16px 10px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.search-box input { flex: 1; border: none; outline: none; font-size: 15px; background: none; }
#searchCancelBtn { font-size: 15px; font-weight: 600; color: var(--accent-deep); }
.search-overlay-body { flex: 1; overflow-y: auto; padding: 4px 16px 40px; }
.search-section-title { font-size: 12px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.search-chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.search-tag-btn { padding: 8px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--ink-soft); }
.search-result-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.search-result-row .offer-logo { width: 38px; height: 38px; border-radius: 10px; }
.search-result-name { font-size: 14px; font-weight: 600; }
.search-result-sub { font-size: 12px; color: var(--ink-faint); }

/* ---------- BOTTOM SHEET (Teklif Detay / Auth) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(10,14,18,0.42); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.sheet-backdrop.show { opacity: 1; pointer-events: all; }
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; max-height: 88vh;
  background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -20px 50px rgba(18,24,31,0.25);
  transform: translateY(100%); transition: transform .38s cubic-bezier(.32,.9,.4,1);
  display: flex; flex-direction: column; overflow: hidden;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 10px auto 4px; flex: none; }
.sheet-content { overflow-y: auto; padding: 6px 20px calc(30px + var(--safe-bottom)); }

.sheet-offer-header { text-align: center; padding: 10px 0 6px; }
.sheet-offer-logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 10px; background: var(--bg); display: grid; place-items: center; font-size: 24px; font-weight: 700; color: var(--accent-deep); overflow: hidden; }
.sheet-offer-logo img { width: 100%; height: 100%; object-fit: cover; }
.sheet-offer-name { font-size: 20px; font-weight: 800; margin: 0; }
.sheet-offer-cat { font-size: 13px; color: var(--ink-faint); margin: 2px 0 10px; }
.sheet-stats-row { display: flex; justify-content: center; gap: 22px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 8px 0 14px; }
.sheet-stat { text-align: center; }
.sheet-stat strong { display: block; font-size: 16px; }
.sheet-stat span { font-size: 11px; color: var(--ink-faint); }
.sheet-section-title { font-size: 13px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 6px; }
.sheet-desc { font-size: 14.5px; line-height: 1.55; color: var(--ink); }
.rating-stars { display: flex; gap: 6px; font-size: 26px; justify-content: center; margin: 6px 0; }
.rating-stars span { filter: grayscale(1); opacity: .35; transition: transform .15s; }
.rating-stars span.filled { filter: none; opacity: 1; }
.rating-stars span:active { transform: scale(1.3); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-fav-btn { width: 52px; height: 48px; border-radius: var(--radius-sm); background: var(--bg); font-size: 20px; display: grid; place-items: center; flex: none; }
.sheet-apply-btn { flex: 1; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-weight: 700; font-size: 15px; }
.sheet-apply-btn:active { background: var(--accent-deep); }

/* ---------- FAVORİLER TOOLBAR ---------- */
.fav-toolbar { display: flex; gap: 8px; margin-top: 8px; }
.fav-toolbar input { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.fav-toolbar select { padding: 10px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.select-multi-btn { padding: 10px 14px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; }
.fav-multi-bar { display: flex; align-items: center; gap: 10px; padding: 10px 4px; font-size: 13px; color: var(--ink-soft); }
.fav-multi-bar button { color: var(--danger); font-weight: 600; }
.fav-check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); flex: none; }
.fav-check.checked { background: var(--accent); border-color: var(--accent); }

/* ---------- PROFİL ---------- */
.profile-guest { text-align: center; padding: 60px 20px; }
.profile-guest button { width: 100%; margin-top: 8px; }
.profile-header { text-align: center; padding: 20px 0; }
.avatar { width: 78px; height: 78px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; font-size: 30px; display: grid; place-items: center; margin: 0 auto 10px; }
.profile-name { font-size: 19px; font-weight: 800; }
.profile-email { font-size: 13px; color: var(--ink-faint); margin-bottom: 14px; }
.profile-stats { display: flex; justify-content: center; gap: 30px; padding: 14px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.profile-stats strong { display: block; font-size: 18px; }
.profile-stats span { font-size: 11.5px; color: var(--ink-faint); }

.settings-group { background: var(--surface); border-radius: var(--radius-md); margin: 14px 0; border: 1px solid var(--border); overflow: hidden; }
.settings-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-size: 14.5px; border-bottom: 1px solid var(--border); }
.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: var(--bg); }
.settings-item span:last-child { color: var(--ink-faint); font-size: 13px; }

.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 23px; height: 23px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(19px); }

.danger-btn { width: 100%; padding: 14px; margin: 8px 0 20px; border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: 15px; }
.primary-btn { padding: 13px 18px; border-radius: var(--radius-md); background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; }
.ghost-btn { padding: 13px 18px; border-radius: var(--radius-md); background: var(--bg); color: var(--ink); font-weight: 700; font-size: 15px; }

/* ---------- AUTH FORM ---------- */
.auth-tabs { display: flex; gap: 8px; margin: 6px 0 16px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; border-radius: 12px; font-weight: 700; font-size: 14px; background: var(--bg); color: var(--ink-soft); }
.auth-tab.active { background: var(--ink); color: #fff; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-faint); margin-bottom: 5px; font-weight: 600; }
.field input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); font-size: 15px; }
.form-error { color: var(--danger); font-size: 13px; margin: 6px 0; min-height: 16px; }
.form-submit { width: 100%; padding: 14px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700; font-size: 15.5px; margin-top: 6px; }
.form-submit:active { background: var(--accent-deep); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom));
  transform: translate(-50%, 20px); background: rgba(18,24,31,0.92); color: #fff;
  padding: 11px 18px; border-radius: 14px; font-size: 13.5px; z-index: 100;
  opacity: 0; pointer-events: none; transition: all .25s; backdrop-filter: blur(10px);
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* iOS reduce-motion desteği */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}

@media (min-width: 720px) {
  #app { max-width: 720px; margin: 0 auto; }
  .topbar-inner, .search-pill, .chip-row { max-width: 720px; margin-left: auto; margin-right: auto; }
  .bottom-nav { max-width: 500px; margin: 0 auto; }
}
