/* =========================================================
   Palette + type. Forest-green nature theme, editorial feel.
   ========================================================= */
:root {
  --forest-900: #1e3a26;
  --forest-800: #26472e;
  --forest-700: #2f5233;
  --forest-600: #3d6b42;
  --forest-500: #557a5b;
  --sage-200:   #d4ddc9;
  --sage-100:   #e8ebe0;
  --cream:      #f9f7f2;
  --paper:      #ffffff;
  --ink:        #1f2b23;
  --ink-soft:   #3d4a41;
  --mute:       #6b7266;
  --border:     #e5e3d9;
  --border-soft:#efece3;
  --accent:     #b08a45;

  --shadow-sm: 0 1px 2px rgba(30,58,38,.06);
  --shadow-md: 0 10px 30px -14px rgba(30,58,38,.25);
  --shadow-lg: 0 24px 60px -24px rgba(30,58,38,.35);

  --font-serif: Georgia, "Times New Roman", "Noto Serif", serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
}

/* =========================================================
   Reset + base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--forest-700); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--forest-900); }
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--forest-900);
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 4.2vw, 3rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.1rem 1.25rem;
}
.logo {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--forest-900);
  font-size: 1.35rem;
  letter-spacing: -.01em;
  display: inline-flex; align-items: center; gap: .5rem;
}
.logo:hover { color: var(--forest-700); }
.logo::before {
  content: '';
  width: 10px; height: 10px;
  background: var(--forest-700);
  border-radius: 50%;
  display: inline-block;
}
.nav {
  display: flex; gap: 1.75rem; align-items: center; flex-wrap: wrap;
}
.nav a {
  color: var(--ink-soft); font-weight: 500; font-size: .95rem;
  position: relative; padding: .25rem 0;
}
.nav a:hover { color: var(--forest-900); }
.phone-link {
  color: var(--forest-900) !important;
  font-weight: 600;
  padding: .5rem 1rem !important;
  background: var(--sage-100);
  border-radius: 999px;
}
.phone-link:hover { background: var(--sage-200); }

/* =========================================================
   Main / hero
   ========================================================= */
.site-main { padding: 2.5rem 1.25rem 4rem; min-height: 60vh; }

.hero {
  text-align: center;
  max-width: 780px;
  margin: 1.5rem auto 3.5rem;
}
.hero-pretitle {
  text-transform: uppercase;
  font-size: .78rem;
  letter-spacing: .18em;
  color: var(--forest-700);
  margin: 0 0 1rem;
  font-weight: 600;
}
.hero h1 { margin-bottom: .75rem; }
.hero-tagline {
  color: var(--mute);
  font-size: 1.1rem;
  margin: 0;
}

/* =========================================================
   Section headings
   ========================================================= */
.listings-section { margin-top: 1rem; }
.section-heading {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.section-heading h2 { margin: 0; }
.section-count { color: var(--mute); font-size: .95rem; }

/* =========================================================
   Toolbar
   ========================================================= */
.toolbar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.sort-form { display: flex; gap: .5rem; align-items: center; }
.sort-form label { color: var(--mute); font-size: .9rem; }
input[type=text], input[type=password], input[type=file], textarea, select {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  width: 100%;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--forest-600);
  box-shadow: 0 0 0 3px rgba(47,82,51,.12);
}
textarea { resize: vertical; min-height: 9rem; line-height: 1.6; }
.sort-form select { width: auto; padding-right: 2rem; }

/* =========================================================
   Grid + cards
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--sage-200);
}
.card-image { aspect-ratio: 4/3; background: var(--sage-100); overflow: hidden; }
.card-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.card:hover .card-image img { transform: scale(1.04); }
.no-image, .no-thumb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--mute); font-size: .9rem; background: var(--sage-100);
}
.card-body { padding: 1.15rem 1.25rem 1.35rem; }
.card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--forest-900);
  margin: 0 0 .4rem;
  line-height: 1.3;
}
.card-price {
  font-weight: 700;
  color: var(--forest-800);
  font-size: 1.1rem;
  margin-bottom: .5rem;
}
.card-meta {
  color: var(--mute); font-size: .9rem;
  display: flex; gap: 1rem; flex-wrap: wrap;
  padding-top: .5rem;
  border-top: 1px solid var(--border-soft);
}

.empty { color: var(--mute); padding: 3rem 0; text-align: center; }

/* =========================================================
   Listing detail
   ========================================================= */
.breadcrumb {
  color: var(--mute); font-size: .88rem; margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--forest-700); }
.breadcrumb span:last-child { color: var(--ink); }
.breadcrumb span:first-of-type { padding: 0 .5rem; color: var(--mute); }

.listing-detail h1 { margin-bottom: 1.5rem; }

.listing-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}
.price-tag {
  font-family: var(--font-serif);
  font-size: 2rem; font-weight: 700; color: var(--forest-900);
  border-right: 1px solid var(--border); padding-right: 2rem;
  line-height: 1;
}
.facts {
  margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}
.facts div { display: flex; flex-direction: column; gap: .25rem; }
.facts dt {
  color: var(--mute); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
}
.facts dd { margin: 0; font-weight: 600; color: var(--ink); }

.phone-big {
  font-size: 1.1rem; color: var(--forest-700); font-weight: 700;
}

.gallery { margin-bottom: 2.5rem; }
.gallery-main {
  background: var(--forest-900); border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 16/10;
  box-shadow: var(--shadow-sm);
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: var(--forest-900); }
.gallery-thumbs {
  margin-top: .85rem; display: flex; gap: .5rem;
  overflow-x: auto; padding-bottom: .25rem;
  scrollbar-width: thin;
}
.thumb {
  flex: 0 0 96px; aspect-ratio: 4/3;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--sage-100); cursor: pointer; overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
}
.thumb:hover { transform: translateY(-2px); }
.thumb.is-active { border-color: var(--forest-700); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.description {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  font-size: 1.02rem;
  color: var(--ink-soft);
}
.description h2 { margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border-soft); }
.description p { margin: 0 0 1em; }
.description p:last-child { margin: 0; }

.contact-cta {
  text-align: center;
  background: var(--forest-900);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  color: var(--sage-100);
}
.contact-cta h2 { color: #fff; margin-bottom: .5rem; }
.contact-cta p { color: var(--sage-200); margin-top: 0; }
.contact-cta .phone-big {
  color: #fff !important;
  background: transparent;
  border: 2px solid rgba(255,255,255,.4);
  padding: .85rem 2rem;
  border-radius: 999px;
  display: inline-block;
  margin-top: .75rem;
  font-size: 1.25rem;
  transition: background .15s ease, border-color .15s ease;
}
.contact-cta .phone-big:hover { background: rgba(255,255,255,.1); border-color: #fff; text-decoration: none; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-block;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1.15rem;
  font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--sage-100); border-color: var(--sage-200); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest-700); color: #fff; border-color: var(--forest-700); }
.btn-primary:hover { background: var(--forest-800); border-color: var(--forest-800); color: #fff; }
.btn-danger { background: var(--paper); color: #a3271b; border-color: #e3c3bf; }
.btn-danger:hover { background: #fdecea; color: #7a1d13; }
.btn-sm { padding: .4rem .8rem; font-size: .88rem; }
.link-button { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0; }
.link-button:hover { text-decoration: underline; }

/* =========================================================
   Forms
   ========================================================= */
.form { max-width: 720px; }
.form label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  margin-bottom: 1.15rem;
}
.form label input,
.form label textarea,
.form label select { font-weight: 400; margin-top: .4rem; }
.form .checkbox { font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.form .checkbox input { width: auto; margin: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.15rem; }
.form-row .form-col-2 { grid-column: 1 / -1; }
.form-actions { margin-top: 1.5rem; }
.hint { display: block; font-weight: 400; font-size: .85rem; color: var(--mute); margin-top: .3rem; }

/* =========================================================
   Alerts
   ========================================================= */
.alert { padding: .9rem 1.15rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-size: .94rem; }
.alert ul { margin: .5rem 0 0 1.2rem; padding: 0; }
.alert-success { background: #eaf3ec; color: #1d6f3f; border: 1px solid #c6dfcb; }
.alert-error   { background: #fdecea; color: #a3271b; border: 1px solid #f1bfb8; }

/* =========================================================
   Auth card
   ========================================================= */
.auth-card {
  max-width: 420px;
  margin: 3rem auto;
  background: var(--paper);
  padding: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 1.25rem; text-align: center; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: var(--forest-900);
  color: var(--sage-100);
  padding: 2rem 0;
  font-size: .9rem;
  margin-top: auto;
}
.footer-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.footer-row p { margin: 0; color: var(--sage-200); }
.footer-admin-link { color: var(--sage-200); font-size: .85rem; opacity: .7; }
.footer-admin-link:hover { color: #fff; opacity: 1; }

/* =========================================================
   Admin
   ========================================================= */
.is-admin { background: var(--cream); }
.is-admin .site-header {
  background: var(--forest-900);
  border-bottom: 0;
}
.is-admin .site-header .logo { color: #fff; }
.is-admin .site-header .logo::before { background: var(--sage-200); }
.is-admin .nav a,
.is-admin .nav .link-button { color: var(--sage-200); }
.is-admin .nav a:hover,
.is-admin .nav .link-button:hover { color: #fff; }

.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.admin-head h1 { margin: 0; font-size: 1.7rem; }

.admin-table {
  width: 100%; border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: .9rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table th {
  font-size: .75rem; color: var(--mute);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600;
  background: var(--cream);
}
.thumb-col { width: 90px; }
.thumb-col img { width: 80px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); }
.thumb-col .no-thumb { width: 80px; height: 60px; border-radius: var(--radius-sm); }
.actions-col { white-space: nowrap; display: flex; gap: .4rem; }
.muted { color: var(--mute); }
.small { font-size: .85rem; }
.inline-form { display: inline; }

.badge {
  display: inline-block; padding: .2rem .65rem;
  border-radius: 999px; font-size: .78rem; font-weight: 600;
}
.badge-on  { background: #eaf3ec; color: #1d6f3f; }
.badge-off { background: var(--sage-100); color: var(--mute); }

.images-section { margin-top: 2.5rem; }
.upload-form { margin-bottom: 1.25rem; max-width: 720px; }
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.image-tile {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.image-tile.is-main { outline: 2px solid var(--forest-700); outline-offset: -2px; }
.image-tile img { aspect-ratio: 4/3; object-fit: cover; width: 100%; }
.image-actions {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .65rem; gap: .3rem; flex-wrap: wrap;
}

/* =========================================================
   Misc
   ========================================================= */
.error-page { text-align: center; padding: 5rem 0; }
.error-page h1 { font-size: 5rem; margin-bottom: .5rem; color: var(--forest-700); }
.error-page p { color: var(--mute); font-size: 1.1rem; }

/* =========================================================
   Mobile
   ========================================================= */
@media (max-width: 720px) {
  .site-main { padding: 1.5rem 1rem 3rem; }
  .hero { margin: 1rem auto 2rem; }
  .hero-pretitle { font-size: .72rem; }
  .listing-summary { grid-template-columns: 1fr; padding: 1.25rem; gap: 1.25rem; }
  .price-tag { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 1rem; font-size: 1.6rem; }
  .form-row { grid-template-columns: 1fr; }
  .header-row { padding: .85rem 1rem; }
  .nav { gap: 1rem; font-size: .9rem; }
  .description { padding: 1.5rem 1.25rem; }
  .contact-cta { padding: 2rem 1rem; }

  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { border-bottom: 1px solid var(--border); padding: .75rem 0; }
  .admin-table td { border: 0; padding: .3rem 1rem; }
  .thumb-col img { width: 100%; height: auto; max-width: 240px; }
}
