:root {
  --wc-blue: #2563eb;
  --wc-blue-deep: #1d4ed8;
  --wc-sky: #38bdf8;
  --wc-sky-deep: #0ea5e9;
  --wc-tint: #eaf4ff;

  --bg: #f4faff;
  --panel: #ffffff;
  --panel2: #eef6ff;
  --text: #0f2138;
  --muted: #5b7291;
  --border: #d9e8fb;
  --error: #e0554f;
  --ok: #16a34a;
  --radius: 22px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font-display: "Baloo 2", "Segoe UI", sans-serif;
  --font-body: "Nunito", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

/* ---------- Köpük / baloncuk arkaplan ---------- */

.bubbles-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bubble {
  position: absolute;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,.95), rgba(255,255,255,.15) 40%, rgba(56,189,248,.16) 70%, rgba(37,99,235,.10) 100%);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: inset 0 0 14px rgba(255,255,255,.5), 0 8px 24px rgba(37,99,235,.10);
  animation: bubble-float 14s ease-in-out infinite;
  opacity: .8;
}
.b1 { width: 120px; height: 120px; left: 4%;  top: 8%;  animation-duration: 16s; }
.b2 { width: 70px;  height: 70px;  left: 82%; top: 14%; animation-duration: 12s; animation-delay: -3s; }
.b3 { width: 46px;  height: 46px;  left: 20%; top: 62%; animation-duration: 10s; animation-delay: -6s; }
.b4 { width: 160px; height: 160px; left: 70%; top: 55%; animation-duration: 20s; animation-delay: -2s; }
.b5 { width: 34px;  height: 34px;  left: 46%; top: 20%; animation-duration: 9s;  animation-delay: -4s; }
.b6 { width: 90px;  height: 90px;  left: 8%;  top: 78%; animation-duration: 15s; animation-delay: -8s; }

@keyframes bubble-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(14px, -22px); }
}

/* ---------- Topbar ---------- */

.topbar {
  position: relative;
  z-index: 2;
  background: linear-gradient(135deg, var(--wc-blue-deep), var(--wc-sky-deep));
  color: #fff;
  padding: 20px 20px 22px;
  text-align: center;
}
.brand {
  font-family: var(--font-display);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 25px;
  font-weight: 700;
}
.brand-icon { font-size: 26px; }
.bubble-dot { font-size: 18px; animation: pop-in .5s var(--ease); }
.tagline { margin: 6px 0 0; font-size: 13.5px; color: #dbeeff; max-width: 380px; margin-inline: auto; line-height: 1.4; }

.profileBtn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s var(--ease), background .15s var(--ease);
}
.profileBtn:hover { background: rgba(255,255,255,.3); transform: scale(1.06); }

/* ---------- Layout ---------- */

.wrap { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 16px 16px 60px; }

.hidden { display: none !important; }

/* ---------- Filtreler ---------- */

.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: none;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s var(--ease);
}
.filter-chip:hover { border-color: var(--wc-sky); }
.filter-chip.active {
  background: linear-gradient(135deg, var(--wc-blue), var(--wc-sky-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,.28);
}

/* ---------- Harita ---------- */

.map-wrap {
  position: relative;
  z-index: 0;
  isolation: isolate; /* Leaflet'in ic panel z-index'leri (1000'e kadar) bu sinirin disina tasmasin */
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 10px 34px rgba(37,99,235,.14);
}
#map {
  width: 100%;
  height: min(60vh, 520px);
  min-height: 360px;
  background: var(--panel2);
  isolation: isolate; /* Leaflet'in ic z-index'leri (kontroller 1000'e kadar cikiyor) #map disina asla tasmasin */
}

.leaflet-container { font-family: var(--font-body); }
.leaflet-tile-pane { filter: saturate(.6) brightness(1.06) contrast(.95); }

.locateBtn, .addFab {
  position: absolute;
  z-index: 900; /* isolation ile sinirlanmis map-wrap icinde Leaflet kontrollerinin (max ~1000) her zaman ustunde ama kapsayici disina tasmadan */
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37,99,235,.35);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.locateBtn:active, .addFab:active { transform: scale(.92); }

.locateBtn {
  right: 14px;
  bottom: 14px;
  width: 46px;
  height: 46px;
  font-size: 19px;
  background: #fff;
  color: var(--wc-blue);
  border: 1.5px solid var(--border);
}

.addFab {
  right: 14px;
  bottom: 70px;
  width: 54px;
  height: 54px;
  font-size: 24px;
  background: linear-gradient(135deg, var(--wc-blue), var(--wc-sky-deep));
  color: #fff;
}
.addFab.active { background: linear-gradient(135deg, var(--error), #ff8a80); }

.add-hint {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  background: rgba(15, 33, 56, .82);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 500;
  animation: fade-up .3s var(--ease);
  white-space: nowrap;
}

/* Leaflet custom pin */
.wc-pin {
  width: 34px; height: 34px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, var(--wc-blue), var(--wc-sky-deep));
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(37,99,235,.4);
  display: flex; align-items: center; justify-content: center;
}
.wc-pin span { transform: rotate(45deg); font-size: 15px; }
.wc-pin.pending {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-style: dashed;
}
.wc-pin.sponsored { background: linear-gradient(135deg, #14b8a6, #0d9488); }

.counter-line { text-align: center; color: var(--muted); font-size: 13.5px; margin: 14px 0 12px; }
.counter-line span { font-weight: 800; color: var(--wc-blue); }

.science-note {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--wc-sky);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0 0 10px;
}

/* ---------- Bottom sheet ---------- */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 33, 56, .35);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-up .2s var(--ease);
}
.sheet {
  position: relative;
  background: var(--panel);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  padding: 14px 20px 28px;
  animation: sheet-up .28s var(--ease);
  box-shadow: 0 -10px 40px rgba(37,99,235,.18);
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.sheet-handle {
  width: 40px; height: 5px;
  border-radius: 999px;
  background: var(--border);
  margin: 4px auto 10px;
}
.sheet-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--panel2);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

/* ---------- Forms ---------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; }
h2 { font-size: 20px; margin-bottom: 12px; }
h3 { font-size: 16px; margin-bottom: 12px; color: var(--wc-blue); display: flex; align-items: center; gap: 6px; }

.field-block { margin-bottom: 16px; }
.field-label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 8px; color: var(--text); }

.text-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
.text-input:focus { border-color: var(--wc-sky); background: #fff; }

.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.chip.active {
  background: linear-gradient(135deg, var(--wc-blue), var(--wc-sky-deep));
  border-color: transparent;
  color: #fff;
}

.toggle-row { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle {
  display: flex; align-items: center; gap: 7px;
  background: var(--panel2);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.toggle input { accent-color: var(--wc-blue); width: 16px; height: 16px; }
.toggle:has(input:checked) {
  background: var(--wc-tint);
  border-color: var(--wc-sky);
  color: var(--wc-blue-deep);
}

.dup-warning {
  background: #fff7e6;
  border: 1px solid #fbd38d;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: #92650c;
  margin-bottom: 14px;
  line-height: 1.5;
}
.dup-warning button {
  display: block;
  margin-top: 8px;
  background: #fff;
  border: 1px solid #fbd38d;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  color: #92650c;
}

.error { color: var(--error); font-size: 13.5px; min-height: 16px; margin: 4px 0; }

/* ---------- Butonlar ---------- */

.primaryBtn {
  background: linear-gradient(135deg, var(--wc-blue), var(--wc-sky-deep));
  color: white;
  border: none;
  padding: 14px 20px;
  min-height: 48px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15.5px;
  font-weight: 800;
  cursor: pointer;
  display: block;
  width: 100%;
  box-shadow: 0 4px 16px rgba(37,99,235,.32);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), opacity .12s;
}
.primaryBtn:hover { box-shadow: 0 6px 20px rgba(37,99,235,.4); }
.primaryBtn:active { transform: scale(.97); }
.primaryBtn:disabled { opacity: .5; cursor: not-allowed; }

.secondaryBtn {
  background: var(--panel2);
  color: var(--wc-blue-deep);
  border: 1.5px solid var(--border);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.secondaryBtn:hover { border-color: var(--wc-sky); }

.linkBtn { background: none; border: none; color: var(--wc-blue); cursor: pointer; font-size: 13.5px; font-weight: 700; }

.share-link-box { display: flex; gap: 8px; }
.share-link-box .text-input { flex: 1; }

/* ---------- Mekan detay içerikleri ---------- */

.toilet-title { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.toilet-title .emoji { font-size: 30px; }
.toilet-title h2 { margin: 0; }
.toilet-sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

.badge-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--wc-blue-deep);
}
.badge.warn { background: #fff7e6; border-color: #fbd38d; color: #92650c; }
.badge.ok { background: #eafbef; border-color: #bbf0c8; color: var(--ok); }
.badge.sponsor { background: #ecfdf5; border-color: #99f6e4; color: #0d9488; }

.rating-big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.rating-big .num { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--wc-blue); }
.rating-big .stars { font-size: 18px; letter-spacing: 2px; }
.rating-big .count { color: var(--muted); font-size: 13px; }

.stars-picker { display: flex; gap: 6px; font-size: 32px; margin: 6px 0 14px; }
.stars-picker span { cursor: pointer; filter: grayscale(1) opacity(.4); transition: filter .1s; }
.stars-picker span.active { filter: none; }

.review-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.review-item:last-child { border-bottom: none; }
.review-item .rv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.review-item .rv-name { font-weight: 700; font-size: 13.5px; }
.review-item .rv-stars { font-size: 13px; }
.review-item .rv-comment { font-size: 13.5px; color: var(--text); line-height: 1.5; }
.review-item .rv-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.review-item .rv-tag { font-size: 11.5px; background: var(--panel2); border-radius: 999px; padding: 3px 9px; color: var(--muted); }

.report-link { text-align: center; margin-top: 14px; }

/* ---------- Profil / stats ---------- */

.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 4px 0 16px; }
.stat-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}
.stat-card .value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--wc-blue); }
.stat-card .label { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 2px; }

.badges-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.badge-pill {
  background: linear-gradient(135deg, var(--wc-tint), #fff);
  border: 1px solid var(--wc-sky);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--wc-blue-deep);
}
.badge-pill.locked { opacity: .4; background: var(--panel2); border-color: var(--border); color: var(--muted); }

.card-section {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

#shareCanvas {
  width: 100%; max-width: 280px; aspect-ratio: 9 / 16;
  display: block; margin: 0 auto 16px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(37,99,235,.25);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,33,56,.9);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 2000;
  animation: fade-up .25s var(--ease);
  white-space: nowrap;
}

/* ---------- Animasyonlar ---------- */

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
