/* HBA Emlak — site ve fpanel ortak tasarım dili */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #15212c;
  --ink-2: #3a4a58;
  --muted: #687886;
  --line: #e2e6eb;
  --brand: #0d3a5c;
  --brand-2: #155a8a;
  --brand-soft: #e8f0f7;
  --accent: #c98a1b;
  --accent-soft: #fbf1df;
  --ok: #1d7f55;
  --ok-soft: #e4f4ec;
  --warn: #9a6408;
  --warn-soft: #fdf3dc;
  --err: #b8362f;
  --err-soft: #fbe8e6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .06);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.hidden, [hidden] { display: none !important; }

/* Düzen */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.grid2, .grid3, .grid4 { display: grid; gap: 12px 14px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card h3 { margin-bottom: 14px; }
.lform .card + .card, .lform .card + .row { margin-top: 16px; }

/* Butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent;
  font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:hover:not(:disabled) { background: #b47a12; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover:not(:disabled) { border-color: #c5ccd4; background: #fafbfc; }
.btn.danger { background: var(--err); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand-2); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(21, 90, 138, .35); outline-offset: 2px; }

/* Form */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #cfd6dd; border-radius: 9px;
  background: #fff; color: var(--ink); font: 15px/1.4 var(--font);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(21, 90, 138, .15); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--brand); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .93rem; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 4px 0 16px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 18px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 3px solid rgba(21, 90, 138, .35); }

/* Fotoğraf yöneticisi */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ph { position: relative; margin: 0; aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph.loading { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.ph .cover { position: absolute; left: 6px; top: 6px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.ph-act { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
.ph-act button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; font-size: 12px; }
.upload { cursor: pointer; }
.sticky-actions { margin-top: 16px; }

/* Rozetler */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-published, .st-approved, .st-active { background: var(--ok-soft); color: var(--ok); }
.st-rejected, .st-blocked { background: var(--err-soft); color: var(--err); }
.st-done, .st-closed, .st-passive { background: #eceff2; color: #50606e; }

/* İlan kartı */
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.lcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.lcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 32, 48, .06), 0 10px 28px rgba(16, 32, 48, .1); }
.lcard-img { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #dfe8f0, #f1f4f7); }
.lcard-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: #a9b8c6; }
.tag { position: absolute; left: 10px; top: 10px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff; background: var(--brand); }
.tag.kiralik { background: var(--brand-2); }
.tag.satilik { background: var(--accent); }
.tag.star { left: auto; right: 10px; background: rgba(13, 58, 92, .88); }
.lcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.lcard .price { font-size: 1.2rem; font-weight: 800; color: var(--brand); }
.lcard .price small { font-size: .8rem; font-weight: 600; color: var(--muted); }
.lcard h3 { font-size: .98rem; font-weight: 600; margin: 0; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lcard .loc { font-size: .85rem; color: var(--muted); }
.specs { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.specs li { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); padding: 3px 8px; border-radius: 6px; }

/* Tablo */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafbfc; }

/* Boş durum, yükleniyor */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty svg { margin: 0 auto 10px; color: #b5c2ce; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; justify-content: center; padding: 80px 0; color: var(--muted); }

/* Bildirim, modal */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { padding: 12px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: .93rem; transition: opacity .4s, transform .4s; }
.toast.err { background: var(--err); }
.toast.warn { background: var(--warn); }
.toast.ok { background: var(--ok); }
.toast.out { opacity: 0; transform: translateY(6px); }
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); color: var(--ink); }
dialog.modal::backdrop { background: rgba(14, 26, 38, .5); }
.modal-body { padding: 22px; }
.modal-body h3 { margin-bottom: 12px; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: .93rem; margin-bottom: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--brand-soft); color: var(--brand); }
