/* ==========================================================================
   KiyakEmlak SaaS — Uygulama kabuğu (sidebar, topbar, sayfa iskeleti)
   ========================================================================== */

.app { min-height: 100vh; }

/* --------------------------------------------------------------------------
   Kenar çubuğu
   -------------------------------------------------------------------------- */
.app-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: var(--z-sidebar);
  width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--bg-sidebar); color: var(--text-sidebar);
  border-right: 1px solid var(--border-sidebar);
  transition: width var(--t-slow), transform var(--t-slow);
}

.sb-brand {
  display: flex; align-items: center; gap: 11px; height: var(--topbar-h);
  padding: 0 18px; flex: none; border-bottom: 1px solid var(--border-sidebar);
}
.sb-logo {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.sb-logo svg { width: 19px; height: 19px; color: #fff; }
.sb-name { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; }
.sb-name b { font-size: 15px; font-weight: 680; color: #fff; letter-spacing: -.015em; white-space: nowrap; }
.sb-name span { font-size: 10px; color: var(--text-sidebar); letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }

/* Ofis seçici */
.sb-office {
  margin: 12px 12px 6px; padding: 9px 11px; border-radius: var(--r-md);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--border-sidebar);
  transition: background var(--t-fast);
}
.sb-office:hover { background: rgba(255,255,255,.08); }
.sb-office .oi {
  width: 30px; height: 30px; flex: none; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-600); color: #fff; font-size: 12px; font-weight: 680;
}
.sb-office .ot { flex: 1; min-width: 0; }
.sb-office .ot b { display: block; font-size: 12.5px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-office .ot span { display: block; font-size: 10.5px; color: var(--text-sidebar); }
.sb-office > svg { width: 15px; height: 15px; color: var(--text-sidebar); flex: none; }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 12px 20px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); background-clip: content-box; }

.sb-group { margin-top: 14px; }
.sb-group:first-child { margin-top: 4px; }
.sb-group-title {
  padding: 0 10px 7px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.32);
  white-space: nowrap; overflow: hidden;
}

.sb-link {
  display: flex; align-items: center; gap: 11px; position: relative;
  padding: 9px 11px; margin-bottom: 1px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500; color: var(--text-sidebar);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.sb-link:hover { background: var(--bg-sidebar-hover); color: #fff; }
.sb-link > svg:first-child { width: 18px; height: 18px; flex: none; opacity: .85; }
.sb-link .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-link .chev { width: 15px; height: 15px; flex: none; opacity: .55; transition: transform var(--t-base); }
.sb-link.is-active {
  background: var(--bg-sidebar-active); color: var(--text-sidebar-active); font-weight: 580;
}
.sb-link.is-active > svg:first-child { opacity: 1; color: var(--brand-300); }
.sb-link.is-active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--brand-400);
}
.sb-link .pill-count { background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); }
.sb-link .pill-count.is-danger { background: var(--danger-500); color: #fff; }
.sb-link .pill-count.is-brand { background: var(--brand-600); color: #fff; }

/* Alt menü */
.sb-sub { overflow: hidden; max-height: 0; transition: max-height var(--t-slow); }
.sb-item.is-open > .sb-link .chev { transform: rotate(90deg); }
.sb-item.is-open > .sb-sub { max-height: 720px; }
.sb-sub .sb-link {
  padding-left: 41px; font-size: 13px; font-weight: 450;
}
.sb-sub .sb-link::after {
  content: ""; position: absolute; left: 19px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.2);
}
.sb-sub .sb-link.is-active::after { background: var(--brand-400); }
.sb-sub .sb-link.is-active::before { display: none; }
.sb-sub .sb-link.is-active { background: transparent; color: #fff; }

/* Alt bilgi */
.sb-foot { flex: none; padding: 12px; border-top: 1px solid var(--border-sidebar); }
.sb-upgrade {
  padding: 14px; border-radius: var(--r-md); position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
}
.sb-upgrade::after {
  content: ""; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px;
  border-radius: 50%; background: rgba(255,255,255,.09);
}
.sb-upgrade h5 { font-size: 13px; color: #fff; margin-bottom: 3px; position: relative; }
.sb-upgrade p { font-size: 11.5px; color: rgba(255,255,255,.75); margin-bottom: 10px; position: relative; }
.sb-upgrade .btn { position: relative; }

/* Daraltılmış kenar çubuğu */
.app.is-mini .app-sidebar { width: var(--sidebar-w-mini); }
.app.is-mini .sb-name,
.app.is-mini .sb-group-title,
.app.is-mini .sb-link .lbl,
.app.is-mini .sb-link .chev,
.app.is-mini .sb-link .pill-count,
.app.is-mini .sb-office .ot,
.app.is-mini .sb-office > svg,
.app.is-mini .sb-foot { display: none; }
.app.is-mini .sb-brand { justify-content: center; padding: 0; }
.app.is-mini .sb-office { justify-content: center; padding: 8px; margin: 12px 14px 6px; }
.app.is-mini .sb-link { justify-content: center; padding: 10px; }
.app.is-mini .sb-link::before { left: -12px; }
.app.is-mini .sb-sub { display: none; }
.app.is-mini .sb-nav { padding-inline: 14px; }
.app.is-mini .app-main { margin-left: var(--sidebar-w-mini); }
/* Mini modda ipucu */
.app.is-mini .sb-link { position: relative; }
.app.is-mini .sb-link[data-label]::after {
  content: attr(data-label); position: absolute; left: calc(100% + 12px); top: 50%;
  transform: translateY(-50%) translateX(-4px); z-index: var(--z-tooltip);
  padding: 6px 10px; font-size: 12px; white-space: nowrap;
  background: var(--gray-900); color: #fff; border-radius: var(--r-sm); box-shadow: var(--sh-md);
  opacity: 0; visibility: hidden; transition: all var(--t-fast); pointer-events: none;
}
.app.is-mini .sb-link[data-label]:hover::after { opacity: 1; visibility: visible; transform: translateY(-50%); }

/* --------------------------------------------------------------------------
   Üst çubuk
   -------------------------------------------------------------------------- */
.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh; display: flex; flex-direction: column;
  transition: margin-left var(--t-slow);
}

.app-topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 12px; padding: 0 var(--page-pad);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border);
}

/* Çalışma alanı anahtarı (Panel ↔ Vitrin) */
.tb-switch { flex: none; }
.tb-switch a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; font-size: 12.5px; font-weight: 550;
  color: var(--text-muted); border-radius: var(--r-sm); transition: all var(--t-fast);
}
.tb-switch a svg { width: 14px; height: 14px; }
.tb-switch a:hover { color: var(--brand-600); background: var(--bg-surface); }

.tb-search { position: relative; flex: 1; max-width: 440px; }
.tb-search .input { height: 38px; padding-left: 37px; padding-right: 56px; background: var(--bg-surface-2); border-color: transparent; }
.tb-search .input:hover { background: var(--bg-surface-3); }
.tb-search .input:focus { background: var(--bg-surface); border-color: var(--brand-500); }
.tb-search .input-icon { left: 12px; }
.tb-search .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }

.tb-actions { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.tb-sep { width: 1px; height: 26px; background: var(--border); margin: 0 7px; }

.tb-profile {
  display: flex; align-items: center; gap: 9px; padding: 4px 9px 4px 4px;
  border-radius: var(--r-full); transition: background var(--t-fast); cursor: pointer;
}
.tb-profile:hover { background: var(--bg-surface-3); }
.tb-profile .pn { line-height: 1.25; text-align: left; }
.tb-profile .pn b { display: block; font-size: 13px; font-weight: 590; color: var(--text-strong); white-space: nowrap; }
.tb-profile .pn span { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.tb-profile > svg { width: 15px; height: 15px; color: var(--text-subtle); }

/* Menü açma düğmesi (mobil) */
.tb-burger { display: none; }

/* --------------------------------------------------------------------------
   Sayfa gövdesi
   -------------------------------------------------------------------------- */
.page { flex: 1; padding: var(--page-pad); width: 100%; max-width: var(--content-max); margin-inline: auto; }
.page-wide { max-width: none; }
.page-flush { padding: 0; max-width: none; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { font-size: 23px; font-weight: 660; letter-spacing: -.018em; }
.page-head .sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }

.filter-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 11px;
  background: var(--brand-50); color: var(--brand-700);
  border-radius: var(--r-full); font-size: 12px; font-weight: 540;
}
.filter-chip button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; opacity: .6; }
.filter-chip button:hover { opacity: 1; background: rgba(0,0,0,.08); }
.filter-chip svg { width: 11px; height: 11px; }

/* Sağ panelli düzen */
.split, .split-lg, .split-left { display: grid; gap: 18px; align-items: start; }
.split { grid-template-columns: 1fr 320px; }
.split-lg { grid-template-columns: 1fr 380px; }
.split-left { grid-template-columns: 300px 1fr; }
@media (max-width: 1279px) { .split, .split-lg, .split-left { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Mobil davranış
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--sh-xl); }
  .app.is-drawer .app-sidebar { transform: none; }
  .app-main { margin-left: 0 !important; }
  .tb-burger { display: inline-grid; }
  .tb-search { max-width: none; }
  .app.is-mini .app-sidebar { width: var(--sidebar-w); }
  .app.is-mini .sb-name, .app.is-mini .sb-group-title, .app.is-mini .sb-link .lbl,
  .app.is-mini .sb-link .chev, .app.is-mini .sb-link .pill-count,
  .app.is-mini .sb-office .ot, .app.is-mini .sb-office > svg,
  .app.is-mini .sb-foot, .app.is-mini .sb-sub { display: revert; }
  .app.is-mini .sb-brand, .app.is-mini .sb-link { justify-content: flex-start; }
}
@media (max-width: 639px) {
  :root { --page-pad: 14px; }
  .page-head h1 { font-size: 20px; }
  .tb-profile .pn { display: none; }
}

/* --------------------------------------------------------------------------
   Kimlik doğrulama sayfaları
   -------------------------------------------------------------------------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
}
.auth-side {
  position: relative; overflow: hidden; padding: 46px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, var(--brand-700) 0%, var(--brand-900) 55%, var(--gray-950) 100%);
  color: #fff;
}
.auth-side::before {
  content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -140px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.11), transparent 68%);
}
.auth-side::after {
  content: ""; position: absolute; width: 400px; height: 400px; left: -150px; bottom: -160px;
  border-radius: 50%; background: radial-gradient(circle, rgba(245,158,11,.16), transparent 68%);
}
.auth-side > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand .sb-logo { width: 40px; height: 40px; border-radius: 12px; }
.auth-brand .sb-logo svg { width: 22px; height: 22px; }
.auth-brand b { font-size: 19px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.auth-pitch h2 { font-size: 32px; line-height: 1.25; color: #fff; letter-spacing: -.025em; margin-bottom: 14px; }
.auth-pitch p { font-size: 15px; color: rgba(255,255,255,.72); max-width: 440px; line-height: 1.65; }
.auth-features { display: grid; gap: 13px; margin-top: 30px; }
.auth-features li { display: flex; align-items: center; gap: 11px; font-size: 14px; color: rgba(255,255,255,.88); }
.auth-features .fi {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px;
  background: rgba(255,255,255,.13); color: #fff;
}
.auth-features .fi svg { width: 14px; height: 14px; }
.auth-stats { display: flex; gap: 34px; }
.auth-stats b { display: block; font-size: 25px; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.auth-stats span { font-size: 12.5px; color: rgba(255,255,255,.6); }

.auth-main {
  display: flex; align-items: center; justify-content: center;
  padding: 46px 24px; background: var(--bg-surface); overflow-y: auto;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-box.wide { max-width: 520px; }
.auth-box h1 { font-size: 26px; letter-spacing: -.02em; margin-bottom: 7px; }
.auth-box .lead { font-size: 13.5px; color: var(--text-muted); margin-bottom: 26px; }
.auth-form { display: grid; gap: 16px; }
.auth-foot { margin-top: 24px; text-align: center; font-size: 13px; color: var(--text-muted); }
.social-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.otp-inputs { display: flex; gap: 10px; justify-content: center; }
.otp-inputs input {
  width: 52px; height: 60px; text-align: center; font-size: 24px; font-weight: 660;
  border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--bg-surface);
  color: var(--text-strong); transition: all var(--t-fast);
}
.otp-inputs input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3.5px var(--ring); }

.pw-meter { display: flex; gap: 4px; margin-top: 6px; }
.pw-meter i { flex: 1; height: 3px; border-radius: var(--r-full); background: var(--border); transition: background var(--t-base); }

@media (max-width: 1023px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* --------------------------------------------------------------------------
   Tam ekran harita sayfası
   -------------------------------------------------------------------------- */
body.is-mapview { overflow: hidden; }
body.is-mapview .app-main { height: 100vh; overflow: hidden; }
.map-shell { position: relative; flex: 1; min-height: 0; }
/* Yalnızca tam ekran harita kabuğu içindeki haritayı mutlak konumlandır.
   Genel bir "#map" kuralı, gömülü haritaları (ilan detayı, iletişim) bozuyordu. */
.map-shell > #map, .map-shell > .leaflet-map { position: absolute; inset: 0; z-index: 1; }
#map, .leaflet-map { background: var(--bg-surface-3); }

.map-panel {
  position: absolute; top: 18px; left: 18px; z-index: 500;
  width: 306px; max-height: calc(100% - 36px); overflow-y: auto;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg);
}
.map-tools { position: absolute; top: 18px; right: 18px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.map-tool {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--sh-sm); color: var(--text-body);
  transition: all var(--t-fast);
}
.map-tool:hover { background: var(--bg-surface-2); color: var(--brand-600); }
.map-tool.is-active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.map-tool svg { width: 18px; height: 18px; }

.map-strip {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 500;
  display: flex; gap: 12px; padding: 14px 16px; overflow-x: auto;
  background: linear-gradient(to top, var(--bg-body) 62%, transparent);
  scroll-snap-type: x mandatory;
}
.map-strip::-webkit-scrollbar { height: 6px; }

/* Leaflet üzerine yazımlar */
.leaflet-container { font-family: var(--font-sans) !important; background: var(--bg-surface-3) !important; }
.leaflet-control-zoom { border: 1px solid var(--border) !important; border-radius: var(--r-md) !important; box-shadow: var(--sh-sm) !important; overflow: hidden; }
.leaflet-control-zoom a {
  background: var(--bg-surface) !important; color: var(--text-body) !important;
  border-bottom-color: var(--border) !important; width: 32px !important; height: 32px !important;
  line-height: 32px !important; font-size: 17px !important;
}
.leaflet-control-zoom a:hover { background: var(--bg-surface-2) !important; color: var(--brand-600) !important; }
.leaflet-control-attribution { background: rgba(255,255,255,.78) !important; font-size: 10px !important; }
html[data-theme="dark"] .leaflet-control-attribution { background: rgba(2,6,23,.7) !important; color: var(--text-subtle) !important; }
/* Koyu temada karanlık döşeme (tile) katmanı kullanılır — CSS filtresi uygulanmaz,
   aksi halde döşemeler çift ters çevrilip aydınlanır. */

.leaflet-popup-content-wrapper {
  border-radius: var(--r-lg) !important; padding: 0 !important; overflow: hidden;
  box-shadow: var(--sh-xl) !important; background: var(--bg-surface) !important;
}
.leaflet-popup-content { margin: 0 !important; width: 262px !important; }
.leaflet-popup-tip { background: var(--bg-surface) !important; }
.leaflet-popup-close-button {
  width: 26px !important; height: 26px !important; top: 7px !important; right: 7px !important;
  background: rgba(15,23,42,.55) !important; color: #fff !important; border-radius: 50% !important;
  font-size: 17px !important; line-height: 24px !important; z-index: 2;
}

/* Özel imleçler */
.pin { position: relative; }
.pin-photo {
  width: 54px; height: 42px; border-radius: 7px; overflow: hidden;
  border: 2.5px solid #fff; box-shadow: 0 3px 10px rgba(15,23,42,.35);
  background: var(--bg-surface-3); transition: transform var(--t-fast);
}
.pin-photo img { width: 100%; height: 100%; object-fit: cover; }
.pin-photo::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #fff;
}
.pin:hover .pin-photo, .pin.is-active .pin-photo { transform: scale(1.12); z-index: 10; }
.pin.is-active .pin-photo { border-color: var(--brand-500); }
.pin-price {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 2px 7px; border-radius: var(--r-full); white-space: nowrap;
  background: var(--brand-600); color: #fff; font-size: 10.5px; font-weight: 680;
  box-shadow: 0 2px 6px rgba(15,23,42,.3);
}
.pin-badge {
  position: absolute; top: -8px; right: -8px; width: 18px; height: 18px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-500); color: #fff; box-shadow: 0 2px 5px rgba(15,23,42,.3);
}
.pin-badge svg { width: 10px; height: 10px; }

.pin-label {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px;
  background: var(--bg-surface); border: 1.5px solid var(--brand-500);
  border-radius: var(--r-full); box-shadow: var(--sh-md);
  font-size: 12px; font-weight: 640; color: var(--brand-700); white-space: nowrap;
}

.cluster-pin {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--brand-600); color: #fff; font-weight: 680;
  box-shadow: 0 0 0 6px rgba(79,70,229,.22), 0 3px 10px rgba(15,23,42,.3);
}
.cluster-pin.sz-s { width: 34px; height: 34px; font-size: 12px; }
.cluster-pin.sz-m { width: 42px; height: 42px; font-size: 13px; }
.cluster-pin.sz-l { width: 52px; height: 52px; font-size: 14px; }

@media (max-width: 767px) {
  .map-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 62vh; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(calc(100% - 54px)); transition: transform var(--t-slow); }
  .map-panel.is-open { transform: none; }
  .map-strip { bottom: 58px; }
}
