/* Arenda — professional ko'chmas mulk portali dizayn tizimi (v2) */
:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --ink: #15221c;
  --ink-2: #47554e;
  --muted: #85938b;
  --line: #e3eae5;
  --primary: #0f9d6e;
  --primary-ink: #0b7a55;
  --primary-2: #12b981;
  --primary-soft: #e3f6ee;
  --accent: #f39b1c;       /* featured / hot */
  --accent-soft: #fdefd6;
  --ok: #12b76a;
  --warn: #f79009;
  --danger: #e5484d;
  --grad-primary: linear-gradient(135deg, #12b981 0%, #0e9d6e 100%);
  --grad-hero: linear-gradient(180deg, #0e8f64 0%, #0b7a55 100%);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 3px rgba(16, 40, 30, 0.06);
  --shadow: 0 6px 20px rgba(16, 40, 30, 0.08);
  --shadow-lg: 0 20px 48px rgba(16, 40, 30, 0.16);
  --maxw: 1220px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b110e; --surface: #121a15; --surface-2: #1a2620; --ink: #eaf3ee; --ink-2: #b3c2b9;
    --muted: #7b8a81; --line: #233029; --primary-soft: #10362a; --accent-soft: #33260f;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4); --shadow: 0 6px 20px rgba(0,0,0,.4); --shadow-lg: 0 20px 48px rgba(0,0,0,.55);
  }
}
:root[data-theme='dark'] {
  --bg: #0b110e; --surface: #121a15; --surface-2: #1a2620; --ink: #eaf3ee; --ink-2: #b3c2b9;
  --muted: #7b8a81; --line: #233029; --primary-soft: #10362a; --accent-soft: #33260f;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4); --shadow: 0 6px 20px rgba(0,0,0,.4); --shadow-lg: 0 20px 48px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.15; font-weight: 750; letter-spacing: -.02em; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; } .mt-lg { margin-top: 30px; } .mb { margin-bottom: 16px; }

/* ---- Header ---- */
.header { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); }
.header .container { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.03em; }
.brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--grad-primary); display: grid; place-items: center; color: #fff; font-size: 18px; box-shadow: 0 3px 10px rgba(15,157,110,.35); }
.nav { display: flex; gap: 2px; align-items: center; }
.nav a { padding: 8px 13px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; transition: .12s; }
.nav a:hover, .nav a.active { background: var(--primary-soft); color: var(--primary-ink); }
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 10px 16px; border-radius: 11px; font-weight: 650; font-size: 14.5px;
  cursor: pointer; transition: .14s ease; white-space: nowrap; font-family: inherit; }
.btn:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(15,157,110,.28); }
.btn-primary:hover { background: var(--primary-ink); border-color: var(--primary-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 10px; }

/* ---- Chips / badges ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: .12s; }
.chip:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 750; letter-spacing: .01em; }
.badge-featured { background: var(--accent); color: #fff; }
.badge-new { background: var(--primary); color: #fff; }
.badge-pending { background: #fff4e5; color: #b25e00; }
.badge-active { background: var(--primary-soft); color: var(--primary-ink); }
.badge-rejected { background: #fdecec; color: #b42318; }
.badge-archived { background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark){ .badge-pending{background:#3a2a12;color:#fdb022} .badge-rejected{background:#3a1a1a;color:#ff8a8a} }

/* ---- Cards / grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(275px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.listing-card { overflow: hidden; display: flex; flex-direction: column; transition: .18s ease; }
.listing-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 25%, var(--line)); }
.listing-card .photo { position: relative; aspect-ratio: 3/2; background: linear-gradient(135deg, #dbe7e1, #eef3f0); overflow: hidden; }
.listing-card .photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.3,1); }
.listing-card:hover .photo img { transform: scale(1.06); }
.listing-card .photo .ph-empty { width: 100%; height: 100%; display: grid; place-items: center; font-size: 44px; color: #a9bcb2;
  background: linear-gradient(135deg, var(--surface-2), var(--surface)); }
.listing-card .photo .tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 1; }
.listing-card .photo .cat-chip { position: absolute; bottom: 10px; left: 10px; background: rgba(11,20,16,.72); color: #fff; font-size: 11.5px;
  font-weight: 700; padding: 4px 10px; border-radius: 8px; backdrop-filter: blur(4px); }
.listing-card .photo .fav { position: absolute; top: 9px; right: 9px; width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.92); display: grid; place-items: center; cursor: pointer; border: none; font-size: 15px; }
.listing-card .body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.listing-card .price { font-size: 20px; font-weight: 850; letter-spacing: -.03em; color: var(--ink); }
.listing-card .price small { font-weight: 600; color: var(--muted); font-size: 12.5px; letter-spacing: 0; }
.listing-card .title { font-weight: 600; font-size: 14.5px; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-card .specs { display: flex; gap: 8px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.listing-card .specs span { display: inline-flex; gap: 4px; align-items: center; }
.listing-card .specs .sep { color: var(--line); font-weight: 400; }
.listing-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.listing-card .loc { color: var(--muted); font-size: 12.5px; display: inline-flex; gap: 4px; align-items: center; overflow: hidden; }
.listing-card .loc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listing-card .ref { color: var(--muted); font-size: 11px; font-weight: 700; font-family: var(--mono); white-space: nowrap; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 650; font-size: 13.5px; color: var(--ink-2); }
.input, .select, .textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  color: var(--ink); font-size: 15px; font-family: inherit; transition: .14s; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 100px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 620px){ .form-grid { grid-template-columns: 1fr; } }
.help-err { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* ---- Hero (portal: search-focused) ---- */
.hero { position: relative; background: var(--grad-hero); color: #fff; padding: 46px 0 40px; overflow: hidden; }
.hero::after { content:''; position:absolute; inset:0; background: radial-gradient(900px 300px at 85% -30%, rgba(255,255,255,.14), transparent 60%); pointer-events:none; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(26px, 4.2vw, 42px); max-width: 18ch; letter-spacing: -.035em; line-height: 1.08; color: #fff; }
.hero p.lead { font-size: 16.5px; color: rgba(255,255,255,.88); max-width: 56ch; margin: 10px 0 0; }
.searchbar { display: flex; gap: 8px; background: var(--surface); border-radius: 14px; padding: 8px; box-shadow: var(--shadow-lg); margin-top: 22px; max-width: 720px; }
.searchbar .input { border: none; background: transparent; color: var(--ink); }
.searchbar .input:focus { box-shadow: none; }
@media (max-width: 560px){ .searchbar { flex-direction: column; } }
.hero .trust { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 20px; color: rgba(255,255,255,.92); font-size: 14px; font-weight: 600; }
.hero .trust span { display: inline-flex; gap: 7px; align-items: center; }
.hero .trust b { color: #fff; }
.hero .trust .grad { color:#fff; }

/* ---- Category tiles ---- */
.cat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
@media (max-width: 760px){ .cat-tiles { grid-template-columns: 1fr; } }
.cat-tile { position: relative; padding: 22px; border-radius: var(--radius); color: #fff; overflow: hidden; min-height: 128px;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow-sm); transition: .18s; }
.cat-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.cat-tile::after { content:''; position:absolute; right:-30px; bottom:-30px; width:140px; height:140px; border-radius:50%; background: rgba(255,255,255,.12); }
.cat-tile > * { position: relative; z-index: 1; }
.cat-tile .emoji { font-size: 40px; transition: transform .3s ease; }
.cat-tile:hover .emoji { transform: scale(1.1) rotate(-4deg); }
.cat-tile h3 { font-size: 20px; margin: 0; color: #fff; }
.cat-tile .cnt { font-size: 13px; opacity: .92; font-weight: 600; margin-top: 3px; }
.cat-zona { background: linear-gradient(135deg, #0e8f64, #0a6f4d); }
.cat-ofis { background: linear-gradient(135deg, #2f7fd6, #1c5aa8); }
.cat-turar { background: linear-gradient(135deg, #f39b1c, #d97a06); }

/* ---- Section head ---- */
.section { padding: 32px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 23px; margin: 0; }

/* ---- Filter bar (portal, sticky) ---- */
.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; box-shadow: var(--shadow-sm); }
.filters .input, .filters .select { width: auto; min-width: 128px; padding: 9px 11px; border-radius: 10px; }

/* ---- Detail header ---- */
.listing-head { margin-bottom: 22px; }
.listing-head h1 { font-size: clamp(22px, 3.2vw, 32px); margin: 12px 0 8px; letter-spacing: -.025em; }
.listing-head .sub { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; font-weight: 600; }
.listing-head .sub span { display: inline-flex; gap: 5px; align-items: center; }
.price-big { font-size: clamp(26px, 4vw, 38px); font-weight: 850; letter-spacing: -.03em; margin: 14px 0; color: var(--primary-ink); }
.price-big small { font-size: 16px; color: var(--muted); font-weight: 600; }
.fact-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.fact-chips .fc { display: inline-flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 14px; font-size: 14px; box-shadow: var(--shadow-sm); }
.fact-chips .fc b { color: var(--ink); font-weight: 750; } .fact-chips .fc .fl { color: var(--muted); }
.detail-card { padding: 22px; margin-top: 16px; }
.detail-card h3 { font-size: 17px; margin-bottom: 12px; }

/* ---- Detail / gallery ---- */
.detail { display: grid; grid-template-columns: 1.65fr 1fr; gap: 26px; align-items: start; }
@media (max-width: 900px){ .detail { grid-template-columns: 1fr; } }
.gallery .main { aspect-ratio: 16/10; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.gallery .thumbs img { width: 82px; height: 62px; object-fit: cover; border-radius: 9px; cursor: pointer; border: 2px solid transparent; }
.gallery .thumbs img.active { border-color: var(--primary); }
.side-card { padding: 22px; position: sticky; top: 82px; }
.side-card .price { font-size: 28px; font-weight: 850; letter-spacing: -.02em; }
.spec-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 9px; }
.spec-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.spec-list li span:first-child { color: var(--muted); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 5px; background: var(--surface-2); padding: 5px; border-radius: 11px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: none; background: transparent; padding: 9px 17px; border-radius: 8px; font-weight: 650; cursor: pointer; color: var(--ink-2); font-family: inherit; font-size: 14.5px; white-space: nowrap; }
.tabs button.active { background: var(--surface); color: var(--primary-ink); box-shadow: var(--shadow-sm); }

/* ---- Stats (admin) ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; }
.stat { padding: 18px 20px; }
.stat .num { font-size: 28px; font-weight: 850; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 13.5px; font-weight: 600; }

/* ---- Table (admin) ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

/* ---- Toast ---- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 600;
  font-size: 14px; display: flex; gap: 10px; align-items: center; animation: toastIn .25s ease; max-width: 340px; }
.toast.ok { background: #0f9d58; } .toast.err { background: #d92d20; } .toast.live { background: var(--primary); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(6, 16, 12, .55); display: grid; place-items: center; z-index: 150; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal .modal-head h3 { margin: 0; font-size: 18px; }
.modal .modal-head .x { border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.modal .modal-head .x:hover { background: var(--surface-2); }
.modal .modal-body { padding: 20px; }
.modal .modal-foot { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }

/* filtr tugmasidagi faol filtrlar soni */
.filter-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; }
/* modal ichidagi kategoriya chiplari */
.mchips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Live dot ---- */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(18,183,106,.55)} 70%{box-shadow:0 0 0 8px rgba(18,183,106,0)} 100%{box-shadow:0 0 0 0 rgba(18,183,106,0)} }

/* ---- Category chooser (e'lon berish 1-qadam) ---- */
.cat-choose { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
@media (max-width: 560px){ .cat-choose { grid-template-columns: 1fr; } }
.cat-choose-btn { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px; border: 1.5px solid var(--line);
  border-radius: 14px; background: var(--surface); cursor: pointer; font-family: inherit; font-size: 15px; color: var(--ink); transition: .15s; }
.cat-choose-btn:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-choose-btn b { font-weight: 750; }

/* ---- Photo uploader ---- */
.uploader { border: 2px dashed var(--line); border-radius: 13px; padding: 22px; text-align: center; cursor: pointer; color: var(--muted); transition: .14s; }
.uploader:hover, .uploader.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.photo-previews { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.photo-previews .pp { position: relative; width: 92px; height: 72px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.photo-previews .pp img { width: 100%; height: 100%; object-fit: cover; }
.photo-previews .pp button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 6px; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }

/* ---- Footer ---- */
.footer { border-top: 1px solid var(--line); margin-top: 46px; padding: 28px 0; color: var(--muted); font-size: 14px; background: var(--surface); }
.footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.footer a:hover { color: var(--primary-ink); }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 8px; }

/* ---- Auth pages ---- */
.auth-wrap { max-width: 420px; margin: 46px auto; }
.auth-card { padding: 28px; box-shadow: var(--shadow); }

/* ---- mobile nav ---- */
.menu-toggle { display: none; }
@media (max-width: 860px){
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--surface); flex-direction: column;
    border-bottom: 1px solid var(--line); padding: 10px; gap: 2px; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .menu-toggle { display: grid; }
}
