/* Tekrar kullanılan parçalar. Ekranlar yalnızca bunları birleştirir. */

/* ---------- simge ---------- */
.icon { width: 24px; height: 24px; flex: none; display: block; }
.icon-sm { width: 20px; height: 20px; }
.icon-xs { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

.icon-tile {
  flex: none; width: 48px; height: 48px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--accent-text);
}
.icon-tile.sm { width: 40px; height: 40px; border-radius: var(--r-sm); }
.icon-tile.danger { background: var(--danger-soft); color: var(--danger-text); }
.icon-tile.warn { background: var(--warn-soft); color: var(--warn-text); }
.icon-tile.info { background: var(--info-soft); color: var(--info-text); }
.icon-tile.neutral { background: var(--surface-2); color: var(--text-2); }

/* ---------- butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--btn-h); padding: 0 var(--s-5); border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1.2;
  background: var(--accent); color: var(--on-accent);
  transition: transform .1s var(--ease), background-color .15s, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.98); background: var(--accent-pressed); }
.btn:disabled { opacity: .45; }
.btn.block { display: flex; width: 100%; }
.btn.lg { min-height: 60px; font-size: var(--fs-lg); }
.btn.sm { min-height: 44px; padding: 0 var(--s-4); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn.secondary:active:not(:disabled) { background: var(--surface-pressed); }
.btn.outline { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.btn.outline:active:not(:disabled) { background: var(--surface-2); }
.btn.danger-outline { background: var(--surface); color: var(--danger-text); box-shadow: inset 0 0 0 1.5px var(--danger-line); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:active:not(:disabled) { background: var(--surface-2); }
.btn.ghost.danger { color: var(--danger-text); }
.btn-row { display: flex; gap: var(--s-2); }
.btn-row > .btn { flex: 1; }
.btn-row > .btn.fit { flex: none; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }

.icon-btn {
  width: 44px; height: 44px; border-radius: var(--r-full); display: grid; place-items: center;
  color: var(--text); background: var(--surface); box-shadow: var(--shadow-1);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn.plain { background: transparent; box-shadow: none; }

.text-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--s-1);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--accent-text);
}
.text-btn.danger { color: var(--danger-text); }
.text-btn.muted { color: var(--text-2); }

/* ---------- kart ve liste ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: var(--s-4);
}
.card + .card { margin-top: var(--s-3); }

.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  min-height: 64px; padding: var(--s-3) var(--s-4);
  position: relative; text-align: left;
}
.list-item + .list-item::before {
  content: ""; position: absolute; top: 0; right: 0; left: var(--s-4); height: 1px; background: var(--border);
}
button.list-item:active, .list-item.pressable:active { background: var(--surface-2); }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: var(--fw-semibold); line-height: 1.3; }
.list-item .sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; line-height: 1.35; }
.list-item .sub.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .trail { color: var(--text-3); display: flex; align-items: center; gap: var(--s-1); font-size: var(--fs-sm); white-space: nowrap; }
.list-item.selected { background: var(--accent-soft); }

/* ---------- küpe ---------- */
.tag {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 60px; height: 34px; padding: 0 10px 0 13px;
  background: var(--tag); color: var(--tag-text);
  border-radius: 6px; box-shadow: inset 0 0 0 1px var(--border-strong), inset 4px 0 0 var(--tag-edge);
  font-weight: var(--fw-bold); font-size: 17px; letter-spacing: .03em; font-variant-numeric: tabular-nums;
  line-height: 1; flex: none;
}
.tag.sm { min-width: 48px; height: 28px; font-size: 14px; padding: 0 8px 0 11px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--border-strong), inset 3px 0 0 var(--tag-edge); }
.tag.xl {
  min-width: 140px; height: 72px; font-size: 38px; padding: 0 20px 0 26px; border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--border-strong), inset 7px 0 0 var(--tag-edge);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- rozet ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px;
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge.success { background: var(--accent-soft); color: var(--accent-text); }
.badge.danger { background: var(--danger-soft); color: var(--danger-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.info { background: var(--info-soft); color: var(--info-text); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-full); font-size: 12px; font-weight: var(--fw-bold);
  background: var(--surface-2); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.count.danger { background: var(--danger); color: #fff; }

/* ---------- uyarı şeridi ---------- */
.banner {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-4); border-radius: var(--r-lg);
  background: var(--info-soft); color: var(--info-text);
}
.banner .body { flex: 1; min-width: 0; }
.banner .title { font-weight: var(--fw-bold); }
.banner .text { font-size: var(--fs-sm); margin-top: 2px; opacity: .92; }
.banner.danger { background: var(--danger-soft); color: var(--danger-text); }
.banner.warn { background: var(--warn-soft); color: var(--warn-text); }
.banner.success { background: var(--accent-soft); color: var(--accent-text); }
.banner .tags { margin-top: var(--s-3); }

/* ---------- başlıklar ---------- */
.page-head { display: flex; align-items: flex-start; gap: var(--s-3); margin: var(--s-2) 0 var(--s-5); }
.page-head .body { flex: 1; min-width: 0; }
.eyebrow {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2);
}
.page-title { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.page-sub { color: var(--text-2); margin-top: 4px; }

.section-head {
  display: flex; align-items: center; gap: var(--s-2);
  margin: var(--s-6) var(--s-1) var(--s-3);
  font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text-2);
}
.section-head .grow { flex: 1; }
.section-head.danger { color: var(--danger-text); }

/* ---------- üst çubuk (alt sayfalar, sihirbaz) ---------- */
.topbar {
  display: flex; align-items: center; gap: var(--s-2); min-height: 48px; margin: 0 0 var(--s-3) -6px;
}
.topbar .title { flex: 1; font-weight: var(--fw-semibold); text-align: center; color: var(--text-2); font-size: var(--fs-sm); }
.topbar .spacer { width: 44px; }

.progress { height: 4px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; margin-bottom: var(--s-6); }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s var(--ease); }

.question { font-size: var(--fs-xl); font-weight: var(--fw-bold); letter-spacing: -.01em; line-height: 1.25; }
.question-sub { color: var(--text-2); margin: 6px 0 0; }
.question-wrap { margin-bottom: var(--s-5); }

/* ---------- form ---------- */
.field { margin-bottom: var(--s-5); }
.label { display: block; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); margin: 0 var(--s-1) var(--s-2); }
.label .opt { font-weight: var(--fw-medium); color: var(--text-3); }
.input {
  width: 100%; height: var(--btn-h); padding: 0 var(--s-4);
  border-radius: var(--r-md); border: 1.5px solid var(--border-strong); background: var(--surface);
  font-size: var(--fs-lg); font-weight: var(--fw-semibold); outline: none; appearance: none; -webkit-appearance: none;
}
.input::placeholder { color: var(--text-3); font-weight: var(--fw-medium); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.input.upper { text-transform: uppercase; }
input[type="date"].input { display: block; min-width: 0; line-height: var(--btn-h); }

.search { position: relative; }
.search .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 50px; }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.check {
  flex: none; width: 28px; height: 28px; border-radius: var(--r-full);
  border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent;
  transition: background-color .12s, border-color .12s;
}
.selected .check, .check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.switch {
  flex: none; width: 52px; height: 32px; border-radius: var(--r-full); background: var(--border-strong);
  position: relative; transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }

.chips { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s-4)); padding: 2px var(--s-4); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-full); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--border);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2);
}
.chip .n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--text); color: var(--bg); box-shadow: none; }
.chip.on .n { color: inherit; opacity: .7; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-3); }
.option {
  display: flex; align-items: center; gap: var(--s-3); min-height: 64px; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1);
  font-weight: var(--fw-semibold); text-align: left; width: 100%;
  transition: box-shadow .12s, background-color .12s;
}
.option:active { background: var(--surface-2); }
.option.selected { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.option .body { flex: 1; min-width: 0; }
.option .sub { font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-medium); margin-top: 2px; }

/* ---------- alt sabit buton alanı ---------- */
.footer-bar {
  position: fixed; left: 0; right: 0; z-index: 15;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  padding: var(--s-3) var(--s-4) var(--s-3);
  background: linear-gradient(to bottom, transparent, var(--bg) 28%);
}
body.no-tabbar .footer-bar { bottom: 0; padding-bottom: calc(var(--s-3) + var(--safe-b)); }
.footer-bar .inner { max-width: calc(var(--page-max) - 2 * var(--s-4)); margin: 0 auto; }

/* ---------- alt menü ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px var(--s-2) var(--safe-b);
  display: flex; justify-content: center;
  background: var(--tabbar-bg);
  backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
body.no-tabbar .tabbar { display: none; }
.tab {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; font-weight: var(--fw-semibold); color: var(--text-3); position: relative;
}
.tab .pill {
  width: 56px; height: 30px; border-radius: var(--r-full); display: grid; place-items: center;
  transition: background-color .2s;
}
.tab.on { color: var(--text); }
.tab.on .pill { background: var(--accent-soft); color: var(--accent-text); }
.tab .dot {
  position: absolute; top: 0; left: calc(50% + 12px); min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--r-full); background: var(--danger); color: #fff; border: 2px solid var(--surface);
  font-size: 11px; font-weight: var(--fw-bold); display: grid; place-items: center; font-variant-numeric: tabular-nums;
}

/* ---------- bildirim ---------- */
.toast {
  position: fixed; left: var(--s-3); right: var(--s-3); z-index: 30;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s-3));
  max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-radius: var(--r-lg);
  background: #1f2937; color: #fff; box-shadow: var(--shadow-2);
  animation: toast-in .25s var(--ease);
}
body.no-tabbar .toast { bottom: calc(var(--safe-b) + 96px); }
body.has-footer .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 92px); }
.toast .icon { color: #7fdcaa; }
.toast.error .icon { color: #ff9b8b; }
.toast .msg { flex: 1; font-size: var(--fs-sm); line-height: 1.35; }
.toast .msg small { display: block; color: #b8bfc4; margin-top: 2px; }
.toast .undo { color: #7fdcaa; font-weight: var(--fw-bold); font-size: var(--fs-sm); padding: 10px 12px; border-radius: var(--r-sm); }
.toast .undo:active { background: rgba(255, 255, 255, .08); }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- boş durum, yükleniyor ---------- */
.empty { text-align: center; padding: var(--s-8) var(--s-5); }
.empty .icon-tile { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto var(--s-4); }
.empty .icon-tile .icon { width: 34px; height: 34px; }
.empty h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.empty p { color: var(--text-2); margin-top: 6px; }
.empty .btn { margin-top: var(--s-5); }

.skeleton { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent);
  transform: translateX(-100%); animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- isim etiketi, fotoğraf ---------- */
.name-tag {
  display: inline-flex; align-items: center; max-width: 132px; height: 34px; padding: 0 12px; flex: none;
  border-radius: 6px; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong);
  font-weight: var(--fw-bold); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.name-tag.sm { height: 28px; max-width: 120px; padding: 0 10px; font-size: var(--fs-sm); }
.name-tag.xl { height: 56px; font-size: var(--fs-xl); max-width: 100%; padding: 0 22px; }
.tag.xs { min-width: 0; height: 20px; font-size: 11px; padding: 0 5px 0 7px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--border-strong), inset 2px 0 0 var(--tag-edge); }
.thumb-wrap { position: relative; flex: none; width: 56px; height: 56px; }
.thumb { width: 56px; height: 56px; border-radius: var(--r-md); object-fit: cover; background: var(--surface-2); display: block; }
.thumb-wrap .tag { position: absolute; right: -4px; bottom: -4px; }
/* klavye değiştirici: arama kutusunun sağında ortalanmış küçük hap */
.kb-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 30px; padding: 0 10px; border-radius: var(--r-full);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--text-2);
  font-size: 12px; font-weight: var(--fw-bold); letter-spacing: .06em; line-height: 1; text-align: center;
}
.kb-toggle:active { background: var(--surface-2); }
@media (hover: hover) { .kb-toggle:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--text-3); } }
.search .input[type="search"] { padding-right: 68px; }
.search .input[type="search"]::-webkit-search-cancel-button { display: none; }
.avatar {
  flex: none; width: 56px; height: 56px; border-radius: var(--r-md); display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); font-weight: var(--fw-bold); font-size: var(--fs-xl);
  box-shadow: inset 0 0 0 1px var(--border);
}
.avatar.sm { width: 36px; height: 36px; border-radius: 50%; font-size: var(--fs-sm); }
.input.upper::placeholder { text-transform: none; }

/* ---------- kenardan kaydırıp geri dönme ---------- */
.swipe-hint {
  position: fixed; left: 0; top: 50%; z-index: 50; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-2);
  transform: translate(-44px, -50%);
}
.swipe-hint svg { width: 20px; height: 20px; }
.swipe-hint.ready { background: var(--accent); color: #fff; }
