:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e2e2df;
  --accent: #0b6b3a;
  --accent-hover: #094f2b;
  --danger: #b23a3a;
  --card: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Nav */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
}
.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-left: auto;
}
.nav-links form { margin: 0; }
.lang-select {
  width: auto;
  padding: 4px 8px;
  font-size: 0.9rem;
}

/* Flash */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.flash-notice { background: #e6f4ea; color: #0b6b3a; border: 1px solid #b7dfc6; }
.flash-alert  { background: #fde8e8; color: #8f1e1e; border: 1px solid #f4b4b4; }

/* Typography */
h1 { font-size: 1.9rem; margin: 0 0 16px; }
h2 { font-size: 1.3rem; margin: 0 0 8px; }
p  { margin: 0 0 12px; }
small, .muted { color: var(--muted); font-size: 0.9rem; }

hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Buttons */
button, input[type="submit"], .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-block;
  font-family: inherit;
}
button:hover, input[type="submit"]:hover, .btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f1e1e; }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--accent); color: #fff; }

/* Forms */
form div { margin-bottom: 14px; }
label { display: block; font-weight: 500; margin-bottom: 4px; color: var(--fg); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
textarea { resize: vertical; min-height: 100px; }
input[type="file"] { font-size: 0.95rem; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 107, 58, 0.12);
}

/* Layout: list + map */
.listings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .listings-layout { grid-template-columns: 1fr; }
}
.map-col {
  position: sticky;
  top: 20px;
}
#listings-map {
  height: 70vh;
  min-height: 400px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Cards / listings */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.listing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.listing-card-media {
  background: #eee;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.listing-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.listing-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.listing-card-body h2 { font-size: 1.05rem; margin: 0; }
.listing-card-price { font-weight: 700; color: var(--accent); font-size: 1.1rem; }
.listing-card-meta { color: var(--muted); font-size: 0.88rem; }
.listing-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #eef6f1;
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 20px;
}
.listing-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.9rem;
  color: var(--fg);
}
.listing-card-specs span::before { content: "·"; margin-right: 4px; color: var(--muted); }
.listing-card-specs span:first-child::before { content: ""; margin: 0; }.listing-card-actions { margin-top: auto; padding-top: 10px; }

/* Detail */
.listing-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.listing-photos a { display: block; cursor: zoom-in; }
.listing-photos img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  transition: opacity 0.15s;
}
.listing-photos a:hover img { opacity: 0.9; }

/* Gallery lightbox */
#gallery-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#gallery-overlay[hidden] { display: none; }
#gallery-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 6px 30px rgba(0,0,0,0.5);
}
.gallery-close, .gallery-nav {
  position: absolute;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.gallery-close:hover, .gallery-nav:hover { background: rgba(255,255,255,0.25); }
.gallery-close { top: 16px; right: 16px; }
.gallery-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.gallery-next { right: 16px; top: 50%; transform: translateY(-50%); }
.gallery-counter {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  color: #fff;
  background: rgba(0,0,0,0.5);
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* Photo thumbnails in edit form */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.photo-thumb--cover { outline: 3px solid var(--accent); border-radius: var(--radius); }
.photo-thumb img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}
.photo-thumb form { margin: 0; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); }
.tab {
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s;
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab--active { color: var(--accent); border-bottom-color: var(--accent); }

/* Inline filter row */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}
.filters-row .filter-label {
  font-size: 1.05rem;
  color: var(--fg);
  font-weight: 500;
  margin-left: 6px;
}
.filters-row .filter-label:first-child { margin-left: 0; }
.filters-row .filter-input {
  width: 100px;
  padding: 8px 10px;
  font-size: 1rem;
}
.filters-row .btn, .filters-row .btn-outline { padding: 8px 14px; font-size: 1rem; }
.filters-row .filter-break { flex-basis: 100%; height: 0; margin: 4px 0; }

/* Errors */
.errors {
  background: #fde8e8;
  border: 1px solid #f4b4b4;
  color: #8f1e1e;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.errors h2 { font-size: 1rem; margin-bottom: 6px; }
.errors ul { margin: 0; padding-left: 20px; }
