/* iDose mobil — "Uygulama" konsepti. Renkler tema tarafından CSS değişkeniyle verilir (app.js TEMALAR). */
:root {
  --bg: #F2F2F7; --card: #FFFFFF; --card2: #E9E9EF; --text: #1C1C1E; --muted: #8E8E93; --line: #E3E3E8;
  --accent: #007AFF; --on-accent: #FFFFFF; --stop: #D93A2B; --ok: #2E7D4F; --warn: #E8A317;
  --radius: 14px; --btn-radius: 12px; --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --head-font: var(--font);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; }
body { overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
img { -webkit-user-drag: none; user-select: none; }
.hidden { display: none !important; }

/* ---------- Üst çubuk ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  padding: calc(var(--sat) + 8px) calc(var(--sar) + 16px) 8px calc(var(--sal) + 16px);
  display: flex; align-items: center; gap: 10px; min-height: 56px; }
.top h1 { font-family: var(--head-font); font-size: 30px; font-weight: 800; margin: 0; flex: 1; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .brandlogo { max-height: 30px; max-width: 110px; object-fit: contain; }
.chip-btn { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; background: var(--card); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.conn-dot.on { background: #34C759; } .conn-dot.wait { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.avatar.big { width: 44px; height: 44px; font-size: 18px; }

/* ---------- İçerik ---------- */
main { padding: 0 calc(var(--sar) + 16px) calc(var(--sab) + 96px) calc(var(--sal) + 16px); max-width: 760px; margin: 0 auto; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 22px 4px 8px; }
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* Kategori çipleri */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 20px; background: var(--card); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); }

/* Favori büyük düğme */
.hero { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--card); border-radius: calc(var(--radius) + 4px); box-shadow: 0 2px 10px rgba(0,0,0,.06); width: 100%; text-align: left; }
.hero img { width: 108px; height: 108px; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0,0,0,.18)); }
.hero .t1 { font-size: 13px; color: var(--muted); font-weight: 600; }
.hero .t2 { font-family: var(--head-font); font-size: 26px; font-weight: 800; line-height: 1.1; margin: 2px 0 4px; }
.hero .go { margin-top: 8px; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 22px; background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* İçecek kartları (2 sütun) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.dcard { position: relative; background: var(--card); border-radius: var(--radius); padding: 10px; display: flex; align-items: center; gap: 8px; min-height: 76px; text-align: left; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.dcard img { width: 54px; height: 54px; object-fit: contain; flex: none; filter: drop-shadow(0 4px 5px rgba(0,0,0,.15)); }
.dcard .nm { font-weight: 700; font-size: 15px; line-height: 1.15; overflow-wrap: anywhere; }
.dcard .nm.long { font-size: 13px; }
.dcard .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dcard .plus { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: var(--card2); display: grid; place-items: center; font-size: 20px; font-weight: 600; flex: none; }
.dcard .badge { position: absolute; top: 6px; right: 8px; font-size: 12px; }
.dcard.add { justify-content: center; border: 2px dashed var(--line); background: transparent; box-shadow: none; color: var(--accent); font-weight: 700; }
.dcard.disabled { opacity: .45; }
.swatch { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; flex: none; }

/* Liste (Ayarlar tarzı) */
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; width: 100%; text-align: left; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 16px; color: #fff; flex: none; }
.li .val { color: var(--muted); font-size: 15px; white-space: nowrap; }
.li .chev::after { content: "›"; color: var(--muted); font-size: 22px; margin-left: 4px; }
.li img.th { width: 40px; height: 40px; object-fit: contain; }
.icon-btn { min-width: 44px; min-height: 44px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 18px; background: var(--card2); }
.icon-btn.on { background: var(--accent); color: var(--on-accent); }
.icon-btn:disabled { opacity: .3; }

/* Anahtar */
.sw { position: relative; width: 51px; height: 31px; flex: none; }
.sw input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 1; cursor: pointer; }
.sw span { position: absolute; inset: 0; border-radius: 16px; background: var(--card2); transition: .2s; }
.sw span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: .2s; }
.sw input:checked + span { background: #34C759; }
.sw input:checked + span::after { transform: translateX(20px); }

/* Düğmeler */
.btn { min-height: 50px; padding: 0 18px; border-radius: var(--btn-radius); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 17px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.sec { background: var(--card2); color: var(--text); }
.btn.stop { background: var(--stop); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* Kaydırıcı */
.slider { padding: 10px 0; }
.slider .lab { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.slider .lab b { color: var(--accent); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--card2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 0; margin-top: -12px; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--card2); }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 2px 6px; }
.input { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 17px; }
.seg { display: flex; background: var(--card2); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; min-height: 40px; border-radius: 9px; font-weight: 600; font-size: 14px; padding: 0 8px; white-space: nowrap; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Canlı durum kartı */
.live { position: fixed; left: calc(var(--sal) + 10px); right: calc(var(--sar) + 10px); bottom: calc(var(--sab) + 74px); z-index: 30; max-width: 740px; margin: 0 auto;
  background: var(--card); border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.22); padding: 12px; display: flex; gap: 12px; align-items: center; }
.live img { width: 60px; height: 60px; object-fit: contain; }
.live .nm { font-weight: 800; font-size: 17px; }
.bar { height: 8px; border-radius: 4px; background: var(--card2); overflow: hidden; margin: 6px 0 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .9s linear; }
.live .stopb { min-width: 92px; min-height: 48px; border-radius: 12px; background: var(--stop); color: #fff; font-weight: 800; }

/* Aşama adımları (detay sayfasında) */
.steps { display: flex; align-items: center; margin: 14px 0; }
.steps .st { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); flex: none; }
.steps .st i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 12px; background: var(--card); }
.steps .st.done i { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps .st.cur i { border-color: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 25%, transparent); }
.steps .st.cur { color: var(--text); font-weight: 700; }
.steps .ln { flex: 1; height: 3px; background: var(--line); margin: 0 4px 18px; }
.steps .ln.done { background: var(--ok); }

/* Alt sekmeler */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; justify-content: space-around;
  padding: 6px calc(var(--sar) + 6px) calc(var(--sab) + 6px) calc(var(--sal) + 6px);
  background: color-mix(in srgb, var(--card) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tab { flex: 1; min-height: 54px; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 12px; position: relative; }
.tab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tab .dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 10px; height: 10px; border-radius: 50%; background: var(--stop); border: 2px solid var(--card); }

/* Sayfa (modal tam ekran) */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 94vh; overflow-y: auto; border-radius: 20px 20px 0 0;
  padding: 8px calc(var(--sar) + 16px) calc(var(--sab) + 18px) calc(var(--sal) + 16px); animation: up .22s ease-out; -webkit-overflow-scrolling: touch; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 8px; min-height: 48px; position: sticky; top: -8px; background: var(--bg); z-index: 2; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 20px; text-align: center; }
.sheet-head .icon-btn { background: transparent; color: var(--accent); font-weight: 600; font-size: 16px; padding: 0 6px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dlg-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.dlg { background: var(--card); border-radius: 20px; padding: 20px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dlg h3 { margin: 6px 0 6px; font-size: 20px; }
.dlg p { margin: 0 0 6px; color: var(--muted); }
.dlg .big-ic { font-size: 44px; }
.dlg .btn + .btn { margin-top: 8px; }
.detail-img { display: block; width: 190px; height: 190px; object-fit: contain; margin: 6px auto; filter: drop-shadow(0 14px 16px rgba(0,0,0,.22)); }
.toast { position: fixed; left: 50%; top: calc(var(--sat) + 12px); transform: translateX(-50%); z-index: 80; background: rgba(30,30,30,.92); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: 90vw; text-align: center; animation: fade .2s; }
.alert-card { display: flex; gap: 12px; align-items: center; background: color-mix(in srgb, var(--warn) 16%, var(--card)); border-radius: var(--radius); padding: 12px; margin: 8px 0; }
.alert-card .ic { font-size: 26px; }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--card2) 0); display: grid; place-items: center; flex: none; }
.ring > span { width: 50px; height: 50px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.stat { font-size: 32px; font-weight: 800; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 70px; }
.bars i { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .8; }

/* Karşılama / bağlan ekranı */
.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--sat) + 24px) calc(var(--sar) + 22px) calc(var(--sab) + 24px) calc(var(--sal) + 22px); max-width: 520px; margin: 0 auto; gap: 12px; }
.welcome .logo { width: 150px; margin: 0 auto 6px; display: block; }
.welcome h2 { text-align: center; margin: 0; font-size: 26px; }
.welcome p { text-align: center; color: var(--muted); margin: 0 0 8px; }
.notice { background: color-mix(in srgb, var(--accent) 10%, var(--card)); border-radius: var(--radius); padding: 14px; font-size: 15px; line-height: 1.4; }
.pin { letter-spacing: .5em; text-align: center; font-size: 28px; font-weight: 700; }
.demo-tag { font-size: 11px; font-weight: 800; color: #fff; background: #AF52DE; padding: 2px 6px; border-radius: 6px; margin-left: 4px; }
.log { font: 11px/1.35 ui-monospace, Menlo, monospace; white-space: pre-wrap; background: var(--card); border-radius: 10px; padding: 8px; max-height: 220px; overflow: auto; color: var(--muted); }
.edit-bar { position: sticky; top: calc(var(--sat) + 60px); z-index: 10; display: flex; gap: 8px; align-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--bg)); border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.palette { display: flex; gap: 10px; flex-wrap: wrap; }
.palette button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; }
.palette button.on { border-color: var(--text); }
.imgpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.imgpick button { aspect-ratio: 1; border-radius: 12px; background: var(--card); border: 2px solid transparent; padding: 4px; }
.imgpick button.on { border-color: var(--accent); }
.imgpick img { width: 100%; height: 100%; object-fit: contain; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.theme-grid button { border-radius: 12px; padding: 8px; min-height: 64px; border: 2px solid transparent; text-align: left; font-size: 13px; font-weight: 700; }
.theme-grid button.on { border-color: var(--accent); }
.theme-grid .sw3 { display: flex; gap: 3px; margin-top: 6px; }
.theme-grid .sw3 i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); }
@media (min-width: 600px) { .top h1 { font-size: 34px; } }
/* Dar telefonlarda kart adı kelime ortasından bölünmesin: "+" gizlenir, görsel küçülür. */
.dcard .nm { overflow-wrap: normal; word-break: normal; hyphens: manual; }
@media (max-width: 440px) { .dcard .plus { display: none; } .dcard img { width: 48px; height: 48px; } .dcard { padding: 10px 8px; } .dcard .nm.long { font-size: 13px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
