/* Villa Takvim — sade, profesyonel, light tema */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e7e9ee;
  --border-strong: #d6dae1;
  --text: #161b22;
  --muted: #69707b;
  --muted-2: #99a0ab;
  --accent: #1b7a5a;
  --accent-700: #145c43;
  --accent-soft: #e6f2eb;
  --danger: #c0392b;
  --danger-soft: #fbeae8;
  --warn: #b07314;
  --warn-soft: #fbf2e2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-md: 0 6px 16px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .06);
  --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; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
svg { display: block; }
.icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- Uygulama duzeni ---------- */
.app { max-width: 760px; margin: 0 auto; padding-bottom: calc(76px + var(--safe-bottom)); min-height: 100vh; }

.appbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: calc(12px + var(--safe-top)) 16px 12px;
  display: flex; align-items: center; gap: 12px;
}
.appbar .brand { display: flex; align-items: center; gap: 10px; }
.appbar .brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.appbar .brand h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.appbar .spacer { flex: 1; }

.sync-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--muted); border-radius: 999px; padding: 7px 12px; font-size: 12.5px; font-weight: 500;
}
.sync-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: #2e9e6b; }
.sync-btn.stale .dot { background: var(--warn); }
.sync-btn.err .dot { background: var(--danger); }
.sync-btn.spinning .icon { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { padding: 16px; }
.view { display: none; }
.view.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Kart ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 2px 10px; }

/* ---------- Takvim basligi ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.nav-btns { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); display: grid; place-items: center;
}
.icon-btn:active { background: var(--surface-2); transform: scale(.96); }

/* Sezon hizli secim */
.season-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.season-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--muted); font-size: 13.5px; font-weight: 550; white-space: nowrap;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.season { color: var(--accent); border-color: #bcdcce; }
.chip.season.active { color: #fff; }

/* Villa filtre/lejand */
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.legend .tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 550; color: var(--text);
}
.legend .tag .swatch { width: 11px; height: 11px; border-radius: 3px; }
.legend .tag.off { opacity: .42; }

/* ---------- Takvim izgarasi ---------- */
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-weekdays div { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted-2); padding: 9px 0; letter-spacing: .03em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.day {
  position: relative; min-height: 64px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 3px;
}
.day:nth-child(7n) { border-right: none; }
.day.pad { background: var(--surface-2); }
.day .num { font-size: 12.5px; font-weight: 550; color: var(--text); align-self: flex-start; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.day.today .num { background: var(--accent); color: #fff; font-weight: 650; }
.day .bars { display: flex; flex-direction: column; gap: 3px; margin-top: auto; }
.bar { height: 7px; border-radius: 2px; opacity: .92; }
.bar.cap-l { border-top-left-radius: 6px; border-bottom-left-radius: 6px; margin-left: 2px; }
.bar.cap-r { border-top-right-radius: 6px; border-bottom-right-radius: 6px; margin-right: 2px; }
.bar.manual { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.45) 0 3px, transparent 3px 6px); }
.day .note-dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.day:active { background: var(--accent-soft); }

/* ---------- Rezervasyon listesi ---------- */
.res-item { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid var(--border); }
.res-item:last-child { border-bottom: none; }
.res-stripe { width: 4px; border-radius: 3px; flex: 0 0 4px; }
.res-body { flex: 1; min-width: 0; }
.res-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.res-villa { font-weight: 600; font-size: 14.5px; }
.res-nights { font-size: 12px; color: var(--muted); white-space: nowrap; }
.res-dates { font-size: 13.5px; color: var(--text); margin-top: 2px; }
.res-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pill.airbnb { background: var(--accent-soft); color: var(--accent-700); }
.pill.manual { background: #eef1f4; color: #4a5360; }

/* ---------- Uyarilar ---------- */
.warn-item { display: flex; gap: 12px; padding: 14px; align-items: flex-start; border-bottom: 1px solid var(--border); }
.warn-item:last-child { border-bottom: none; }
.warn-ic { flex: 0 0 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; }
.warn-ic.turnover { background: var(--warn-soft); color: var(--warn); }
.warn-ic.overlap { background: var(--danger-soft); color: var(--danger); }
.warn-text { font-size: 13.5px; }
.warn-text .t { font-weight: 600; }
.warn-text .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.empty { text-align: center; color: var(--muted); padding: 44px 20px; }
.empty .icon { width: 34px; height: 34px; margin: 0 auto 12px; stroke-width: 1.4; color: var(--muted-2); }
.empty p { margin: 0; font-size: 14px; }

/* ---------- Ayarlar ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
input[type=text], input[type=url], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 15px; font-family: inherit; color: var(--text); background: var(--surface); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 84px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: var(--radius-sm); padding: 12px 18px; font-size: 14.5px; font-weight: 600; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-700); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; }

.villa-edit { padding: 14px; border-bottom: 1px solid var(--border); }
.villa-edit:last-child { border-bottom: none; }
.villa-edit .row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.color-dot { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 26px; border: 1px solid rgba(0,0,0,.08); }

.export-row { display: flex; gap: 10px; padding: 12px 14px; align-items: center; border-bottom: 1px solid var(--border); }
.export-row:last-child { border-bottom: none; }
.export-row .name { flex: 1; font-weight: 550; font-size: 14px; }

/* ---------- Alt gezinme ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; padding-bottom: var(--safe-bottom);
  max-width: 760px; margin: 0 auto;
}
.tabbar button {
  flex: 1; background: none; border: none; padding: 9px 0 7px; color: var(--muted-2);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 550;
}
.tabbar button .icon { width: 23px; height: 23px; stroke-width: 1.7; }
.tabbar button.active { color: var(--accent); }
.tabbar button .badge-count { position: absolute; transform: translate(14px, -6px); background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }

/* ---------- Alt sayfa (bottom sheet) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(16, 22, 30, .42); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-md);
  max-width: 760px; margin: 0 auto; transform: translateY(100%); transition: transform .28s cubic-bezier(.32,.72,0,1);
  max-height: 86vh; display: flex; flex-direction: column; padding-bottom: var(--safe-bottom);
}
.sheet.open { transform: translateY(0); }
.sheet .grip { width: 38px; height: 4px; background: var(--border-strong); border-radius: 3px; margin: 10px auto 4px; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 12px; border-bottom: 1px solid var(--border); }
.sheet .sheet-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.sheet .sheet-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.sheet .sheet-body { overflow-y: auto; padding: 16px 18px 22px; }
.close-x { width: 34px; height: 34px; border-radius: 9px; border: none; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; }

.day-status { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 12px; }
.day-status .sw { width: 4px; border-radius: 3px; flex: 0 0 4px; }
.day-status .info { flex: 1; }
.day-status .info .name { font-weight: 600; font-size: 14px; }
.day-status .info .det { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.day-status.free { opacity: .85; }

.note-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); }
.note-card .nbar { width: 3px; border-radius: 3px; background: var(--warn); flex: 0 0 3px; }
.note-card .ntext { flex: 1; font-size: 13.5px; white-space: pre-wrap; }
.note-card .nmeta { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }
.note-card .nact { display: flex; gap: 6px; }
.mini-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: grid; place-items: center; }

.toast { position: fixed; bottom: calc(86px + var(--safe-bottom)); left: 50%; transform: translateX(-50%) translateY(20px); background: #14181f; color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-md); z-index: 80; opacity: 0; pointer-events: none; transition: all .25s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 620px) {
  .day { min-height: 78px; }
}
