/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:         #f3f4f6;
  --card:       #ffffff;
  --text:       #111827;
  --muted:      #6b7280;
  --line:       #e5e7eb;
  --accent:     #d4a017;
  --accent-d:   #b8860b;
  --dark:       #111827;
  --dark2:      #1f2937;
  --green:      #16a34a;
  --blue:       #2563eb;
  --red:        #dc2626;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
  --shadow:     0 8px 24px rgba(0,0,0,.09);
  --shadow-lg:  0 16px 48px rgba(0,0,0,.12);
  --radius:     16px;
  --radius-lg:  24px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.wrap      { max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.wrap-sm   { max-width: 640px;  margin: 0 auto; padding: 0 16px; }
.wrap-md   { max-width: 900px;  margin: 0 auto; padding: 0 16px; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, var(--dark), var(--dark2));
  color: #fff;
  padding: 16px 0;
  box-shadow: 0 4px 18px rgba(0,0,0,.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar .logo {
  font-size: 20px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.5px;
  flex-shrink: 0;
}
.topbar .logo span { color: #fff; }
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}
.topbar-nav a, .topbar-nav button {
  color: #d1d5db;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: none;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.topbar-nav a:hover, .topbar-nav button:hover { color: #fff; background: rgba(255,255,255,.1); }
.topbar-nav .btn-accent {
  background: var(--accent);
  color: var(--dark);
  font-weight: 800;
}
.topbar-nav .btn-accent:hover { background: var(--accent-d); color: var(--dark); }
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body   { padding: 20px; }
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--line); background: #fafafa; }

/* ── House card ────────────────────────────────────────────────────────────── */
.house-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.house-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.house-card .thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--line);
}
.house-card .thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #9ca3af;
}
.house-card .body   { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.house-card .price  { font-size: 20px; font-weight: 900; color: var(--accent-d); }
.house-card .title  { font-size: 14px; font-weight: 700; line-height: 1.4; }
.house-card .loc    { font-size: 12px; color: var(--muted); }
.house-card .badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.badge-new      { background: #dcfce7; color: #166534; }
.badge-promoted { background: #fef3c7; color: #92400e; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-admin    { background: #ede9fe; color: #5b21b6; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:hover  { opacity: .9; }
.btn:active { transform: scale(.97); }
.btn-sm     { padding: 7px 14px; font-size: 12px; }
.btn-lg     { padding: 14px 28px; font-size: 16px; }
.btn-primary  { background: var(--accent);  color: var(--dark); }
.btn-dark     { background: var(--dark);    color: #fff; }
.btn-blue     { background: var(--blue);    color: #fff; }
.btn-green    { background: var(--green);   color: #fff; }
.btn-red      { background: var(--red);     color: #fff; }
.btn-light    { background: #fff;           color: var(--text); border: 1px solid var(--line); }
.btn-ghost    { background: transparent;    color: var(--muted); border: 1px solid var(--line); }
.btn-block    { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.field   { display: flex; flex-direction: column; gap: 6px; }
label, .label { font-size: 13px; font-weight: 700; color: #374151; }
.input, .select, .textarea {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 14px;
  font-size: 15px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212,160,23,.15);
}
.input.error, .select.error { border-color: var(--red); }
.help  { font-size: 12px; color: var(--muted); }
.textarea { resize: vertical; min-height: 90px; }

.form-row   { display: grid; gap: 14px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 600px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

/* ── Alerts / Flash ────────────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #93c5fd; color: #1e40af; }
.alert-warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  transition: background .15s;
}
.pagination a:hover    { background: var(--accent); color: var(--dark); border-color: var(--accent); }
.pagination .active    { background: var(--dark); color: #fff; border-color: var(--dark); }
.pagination .disabled  { opacity: .4; pointer-events: none; }

/* ── Stats grid ────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.stat-card .num   { font-size: 32px; font-weight: 900; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── House grid ────────────────────────────────────────────────────────────── */
.house-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ── Map ───────────────────────────────────────────────────────────────────── */
#map { width: 100%; height: 480px; border-radius: var(--radius); overflow: hidden; }

/* ── Leaflet popup override ────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; font-family: inherit; }
.popup-title  { font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.popup-price  { font-weight: 900; color: var(--accent-d); font-size: 16px; }
.popup-loc    { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.popup-links  { display: flex; gap: 6px; margin-top: 8px; }
.popup-links a { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 8px;
                  background: var(--dark); color: #fff; }
.popup-links a.maps  { background: #1a73e8; }
.popup-links a.waze  { background: #33ccff; color: var(--dark); }

/* ── Sections ──────────────────────────────────────────────────────────────── */
.section       { padding: 32px 0; }
.section-title { font-size: 22px; font-weight: 900; margin-bottom: 20px; }
.section-title span { color: var(--accent); }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.divider     { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 13px; }
.text-right  { text-align: right; }
.d-flex      { display: flex; }
.align-center { align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mb-16       { margin-bottom: 16px; }
.fw-900      { font-weight: 900; }
.w-100       { width: 100%; }

/* ── Loading spinner ───────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--dark);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer {
  background: var(--dark);
  color: #9ca3af;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  margin-top: 48px;
}
.footer a { color: var(--accent); }

@media (max-width: 768px) {
  .house-grid { grid-template-columns: 1fr 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .house-grid { grid-template-columns: 1fr; }
  #map        { height: 340px; }
}

/* ── Promoted card highlight ───────────────────────────────────────────────── */
.house-card.is-promoted {
  border: 2.5px solid var(--accent);
  box-shadow: 0 4px 20px rgba(212,160,23,.25);
}
.house-card.is-promoted:hover {
  box-shadow: 0 8px 32px rgba(212,160,23,.35);
}
.house-card.is-promoted .body::before {
  content: '⭐ PROMOVAT';
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  color: var(--dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .5px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 2px;
  width: fit-content;
}
