/* Nöbetçi — gece 2'de, tek elle, karanlıkta kullanılmak için */
:root {
  --bg: #101820;
  --surface: #1a2532;
  --surface-2: #233140;
  --line: #2f3f50;
  --text: #f2f5f7;
  --muted: #9aaab8;
  --eczane: #3ddc97;
  --noter: #5aa9ff;
  --veteriner: #f5b841;
  --acil: #ff4b4b;
  --accent: var(--eczane);
  --radius: 18px;
  --tap: 60px;
  --fs: 18px;
  color-scheme: dark;
}
:root[data-textsize="big"] { --fs: 21px; --tap: 68px; }
:root[data-textsize="huge"] { --fs: 24px; --tap: 76px; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #000; padding: .5rem 1rem; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem;
  position: sticky; top: 0; background: rgba(16,24,32,.92); backdrop-filter: blur(8px); z-index: 5;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 22%, transparent 24%), var(--eczane);
  box-shadow: 0 0 0 3px rgba(61,220,151,.25);
}
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: -.01em; }
.top-actions { display: flex; align-items: center; gap: .6rem; }
.icon-btn {
  min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; padding: 0 .6rem;
}
.icon-btn span { font-size: 1.25em; }
.net { font-size: .8rem; color: var(--muted); }
.net.is-ok { color: var(--eczane); }
.net.is-off { color: var(--veteriner); }

.wrap { max-width: 720px; margin: 0 auto; padding: 1rem; }

.loc { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.btn {
  min-height: var(--tap); border-radius: var(--radius); border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 700; padding: 0 1rem; text-decoration: none;
}
.btn svg { width: 1.3em; height: 1.3em; fill: currentColor; }
.btn-loc { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-loc:active { background: var(--line); }
.select-wrap { display: flex; }
select {
  width: 100%; min-height: var(--tap); border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; padding: 0 1rem;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}

/* Dört büyük sekme */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.tab {
  --c: var(--muted);
  min-height: calc(var(--tap) + 24px);
  border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  padding: .5rem .25rem; color: var(--text);
}
.tab-icon svg { width: 30px; height: 30px; fill: var(--c); }
.tab-label { font-weight: 700; font-size: .95rem; }
.tab-eczane { --c: var(--eczane); } .tab-noter { --c: var(--noter); }
.tab-veteriner { --c: var(--veteriner); } .tab-acil { --c: var(--acil); }
.tab.is-active { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.tab:active { transform: scale(.97); }

.panel { min-height: 40vh; }
.panel[data-tab="eczane"] { --accent: var(--eczane); }
.panel[data-tab="noter"] { --accent: var(--noter); }
.panel[data-tab="veteriner"] { --accent: var(--veteriner); }
.panel[data-tab="acil"] { --accent: var(--acil); }

.hello {
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--accent);
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
}
.hello h1 { margin: 0 0 .4rem; font-size: 1.6rem; letter-spacing: -.02em; }
.hello h2 { margin: 0 0 .4rem; font-size: 1.3rem; }
.hello p { margin: 0 0 .6rem; color: var(--muted); }
.hello p:last-child { margin-bottom: 0; }
.soon { display: inline-block; margin-top: .4rem; font-size: .85rem; color: var(--accent); font-weight: 700; }

.foot { max-width: 720px; margin: 2rem auto 0; padding: 0 1rem 1.5rem; color: var(--muted); font-size: .85rem; }
.foot p { margin: 0 0 .6rem; }
.foot nav { display: flex; gap: 1.2rem; align-items: center; }
.foot a { color: var(--muted); }

@media (max-width: 380px) { .tab-label { font-size: .85rem; } .loc { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (prefers-contrast: more) { :root { --line: #6b7d90; --muted: #c3cfda; } }

/* ---------- ACİL ---------- */
.call-112 {
  display: flex; align-items: center; gap: 1rem; text-decoration: none; color: #fff;
  background: var(--acil); border-radius: var(--radius); padding: 1rem 1.2rem; min-height: 96px;
  box-shadow: 0 6px 24px rgba(255,75,75,.35); margin-bottom: .8rem;
}
.call-112:active { filter: brightness(.9); }
.call-112-num { font-size: 2.8rem; font-weight: 900; letter-spacing: -.03em; line-height: 1; }
.call-112-txt { display: flex; flex-direction: column; gap: .15rem; }
.call-112-txt strong { font-size: 1.2rem; }
.call-112-txt span { font-size: .9rem; opacity: .9; }
.btn-share { width: 100%; background: var(--surface-2); border: 2px solid var(--acil); color: var(--text); }
.hint { color: var(--muted); font-size: .85rem; margin: .5rem .2rem 1rem; }
.cat h2 { font-size: 1rem; color: var(--muted); font-weight: 700; margin: 1rem .2rem .5rem; }
.numlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.numrow {
  display: grid; grid-template-columns: 4.2rem 1fr 28px; align-items: center; gap: .8rem;
  min-height: var(--tap); padding: .5rem 1rem; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.numrow:active { background: var(--surface-2); }
.numrow-num { font-size: 1.5rem; font-weight: 800; color: var(--acil); }
.numrow-name { font-weight: 600; }
.numrow-icon { width: 24px; height: 24px; fill: var(--muted); }

.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-card { width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; padding: 1.2rem 1rem calc(1rem + env(safe-area-inset-bottom)); display: grid; gap: .6rem; }
.sheet-card p { margin: 0 0 .4rem; font-weight: 700; }
.btn-wa { background: #25d366; color: #062; }
.btn-sms { background: var(--noter); color: #012; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #fff; color: #000; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 700; opacity: 0; transition: .2s; pointer-events: none; z-index: 30; }
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- ECZANE ---------- */
.daybar { display: grid; grid-template-columns: auto auto 1fr; gap: .5rem; margin-bottom: .8rem; }
.day { min-height: 48px; padding: 0 1.1rem; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; }
.day.is-on { border-color: var(--eczane); background: color-mix(in srgb, var(--eczane) 16%, var(--surface)); }
#ph-search { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; padding: 0 .9rem; min-width: 0; }
.listmeta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .9rem; margin: .2rem .2rem .6rem; }
.linkbtn { background: none; border: 0; color: var(--eczane); font-weight: 700; text-decoration: underline; padding: .4rem; }
.group h2 { font-size: 1rem; color: var(--muted); margin: 1rem .2rem .5rem; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--eczane); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .6rem; }
.pcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.pcard h3 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.badge { flex-shrink: 0; font-size: .75rem; font-weight: 700; background: var(--veteriner); color: #221; padding: .2rem .5rem; border-radius: 999px; }
.pcard-addr { margin: .4rem 0 .2rem; }
.pcard-addr .dir { color: var(--muted); font-size: .9rem; }
.pcard-meta { margin: 0 0 .7rem; color: var(--muted); font-size: .85rem; }
.pcard-actions { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: .45rem; }
.btn-call { background: var(--eczane); color: #052; }
.btn-dir { background: var(--surface-2); color: var(--text); border: 2px solid var(--eczane); }
.btn-mini { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); padding: 0 .9rem; }
.btn-mini svg { width: 1.3em; height: 1.3em; fill: currentColor; }
.btn-mini[disabled] { opacity: .35; cursor: default; }
.btn-disabled { background: var(--surface-2); color: var(--muted); }
.fallback-actions { display: grid; gap: .5rem; margin-top: .8rem; }
.warn { background: color-mix(in srgb, var(--veteriner) 18%, var(--surface)); border: 1px solid var(--veteriner); color: var(--text); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .8rem; font-size: .95rem; }
.warn a { color: var(--veteriner); font-weight: 700; }
.source { color: var(--muted); font-size: .8rem; margin: 1rem .2rem 0; }
.source a { color: var(--muted); }

#mapwrap { position: fixed; inset: 0; z-index: 25; background: var(--bg); display: flex; flex-direction: column; }
#mapwrap[hidden] { display: none; }
.mapbar { display: flex; justify-content: space-between; align-items: center; padding: calc(.5rem + env(safe-area-inset-top)) 1rem .5rem; border-bottom: 1px solid var(--line); }
#map { flex: 1; }
.leaflet-container { background: #1a2532; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #fff; color: #111; }
.leaflet-popup-content a { color: #0a7; font-weight: 700; }
@media (max-width: 420px) { .daybar { grid-template-columns: 1fr 1fr; } #ph-search { grid-column: 1 / -1; } .pcard-actions { grid-template-columns: 1fr 1fr auto auto; } }

/* ---------- KONUM / MESAFE ---------- */
.btn-loc.is-on { border-color: var(--noter); color: var(--noter); }
.btn-loc.is-busy { opacity: .6; }
.km { flex-shrink: 0; font-weight: 800; color: var(--eczane); font-size: 1.05rem; white-space: nowrap; }
.pcard-head .badge + .km, .pcard-head .km + .badge { margin-left: .3rem; }
.nearest h2 { color: var(--eczane); }
.pcard.is-big { border-left-width: 8px; background: color-mix(in srgb, var(--eczane) 8%, var(--surface)); }
.pcard.is-big h3 { font-size: 1.3rem; }
.geo-cta { width: 100%; min-height: 52px; border-radius: 12px; border: 1px dashed var(--noter); background: transparent; color: var(--noter); font-weight: 700; margin-bottom: .8rem; }

/* ---------- NOTER ---------- */
.nstatus { border-radius: 12px; padding: .8rem 1rem; font-weight: 700; margin-bottom: .7rem; border: 1px solid var(--line); background: var(--surface); }
.nstatus.is-open { border-color: var(--eczane); color: var(--eczane); }
.nstatus.is-closed { border-color: var(--veteriner); color: var(--veteriner); }
.btn-tnb { width: 100%; background: var(--noter); color: #012; font-size: 1.05rem; }
.rules { margin: .4rem 0 .8rem; padding-left: 1.2rem; color: var(--text); }
.rules li { margin: .25rem 0; }
.numrow-num--sm { font-size: 1.05rem; }

/* ---------- TEMA: açık ---------- */
:root[data-theme="light"] { --bg: #f4f6f8; --surface: #ffffff; --surface-2: #e9eef3; --line: #cfd8e1; --text: #111a22; --muted: #4e5d6b; color-scheme: light; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] { --bg: #f4f6f8; --surface: #ffffff; --surface-2: #e9eef3; --line: #cfd8e1; --text: #111a22; --muted: #4e5d6b; color-scheme: light; } }
:root[data-theme="light"] .top, :root[data-theme="auto"] .top { background: color-mix(in srgb, var(--bg) 92%, transparent); }
:root[data-theme="light"] .btn-call { color: #032; } :root[data-theme="light"] .brand-mark { box-shadow: 0 0 0 3px rgba(61,220,151,.35); }
/* Yüksek kontrast */
:root[data-contrast="1"] { --line: #8fa3b6; --muted: #dbe5ee; --eczane: #5cf5b0; --noter: #8ec3ff; --veteriner: #ffd166; --acil: #ff6b6b; }
:root[data-contrast="1"][data-theme="light"] { --line: #3a4a5a; --muted: #22303c; --eczane: #0a7f4f; --noter: #0b57c2; --veteriner: #8a5a00; --acil: #c81e1e; }
:root[data-contrast="1"] .pcard, :root[data-contrast="1"] .numrow, :root[data-contrast="1"] .tab { border-width: 2px; }

/* ---------- AYARLAR ---------- */
.icon-btn.is-on { border-color: var(--eczane); color: var(--eczane); }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setrow:last-child { border-bottom: 0; }
.setrow > span { font-weight: 700; }
.segs { display: flex; gap: .35rem; flex-wrap: wrap; }
.seg { min-height: 42px; padding: 0 .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-weight: 700; }
.seg.is-on { border-color: var(--eczane); background: color-mix(in srgb, var(--eczane) 18%, var(--surface)); }
#set-province { min-height: 42px; border-radius: 10px; padding: 0 2.2rem 0 .8rem; background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; width: auto; }

/* ---------- ÇEVRİMDIŞI ---------- */
#offline { background: var(--veteriner); color: #221; font-weight: 700; text-align: center; padding: .5rem 1rem; font-size: .9rem; }

/* ---------- İL SEÇİCİ ---------- */
.btn-province { width: 100%; justify-content: space-between; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); text-align: left; }
.pb-caret { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--muted); }
.sheet-top { align-items: flex-start; }
.picker { border-radius: 0 0 var(--radius) var(--radius); padding-top: calc(.8rem + env(safe-area-inset-top)); max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.picker-head { display: flex; gap: .5rem; }
#pp-search { flex: 1; min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.05rem; padding: 0 .9rem; }
.picker-near { align-self: flex-start; }
.picker-list { list-style: none; margin: .3rem 0 0; padding: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.picker-list li button { width: 100%; display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: center; gap: .6rem; min-height: 50px; padding: .4rem .6rem; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; font-weight: 600; }
.picker-list li button.is-cur { background: color-mix(in srgb, var(--eczane) 14%, transparent); }
.pp-code { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.pp-ok { color: var(--eczane); font-size: .8rem; font-weight: 700; }
.pp-no { color: var(--muted); font-size: .8rem; }
