/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  background: #f7f6f4;
  margin: 0;
}

.listings-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.listings-page h1 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.listings-page h1 .count {
  color: #888;
  font-weight: normal;
  font-size: 1.1rem;
}

.empty-state {
  color: #666;
}

.listings-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.5rem;
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-field label,
.filter-field-label {
  font-size: 0.85rem;
  color: #666;
}

.filter-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-range input,
.filter-field > input[type="number"] {
  width: 110px;
  padding: 0.4rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

.filter-checkboxes {
  display: flex;
  gap: 1rem;
}

.filter-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #1a1a1a;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.filter-submit {
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-reset {
  font-size: 0.85rem;
  color: #666;
}

.listings-map {
  height: 420px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.map-popup {
  min-width: 160px;
}

.map-popup a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.map-popup-photo {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.4rem;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.listing-card {
  display: block;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.listing-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.listing-photo {
  aspect-ratio: 4 / 3;
  background: #e5e3df;
}

.listing-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.listing-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.9rem;
}

.listing-body {
  padding: 1rem 1.1rem 1.2rem;
}

.listing-address {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

.listing-price {
  font-weight: 600;
  color: #2a6f4b;
  margin: 0 0 0.6rem;
}

.listing-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  padding: 0;
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  color: #444;
}

.listing-facts li:not(:last-child)::after {
  content: "·";
  margin-left: 0.6rem;
  color: #bbb;
}

.listing-agency {
  font-size: 0.82rem;
  color: #888;
  margin: 0;
}

.listings-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.pagination-link {
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s ease;
}

.pagination-link:hover {
  background: #333;
}

.pagination-status {
  font-size: 0.88rem;
  color: #666;
}

/* Listing detail page */

.listing-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.listing-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.listing-gallery-item {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
}

.listing-gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox-overlay[hidden] {
  display: none;
}

.lightbox-image {
  max-width: 88vw;
  max-height: 88vh;
  object-fit: contain;
  display: block;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-close {
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.6rem;
  line-height: 1;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-prev {
  left: 1.25rem;
}

.lightbox-next {
  right: 1.25rem;
}

.lightbox-counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.listing-photo-placeholder.large {
  aspect-ratio: 16 / 7;
  border-radius: 8px;
  background: #e5e3df;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  margin-bottom: 1.5rem;
}

.listing-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.listing-detail-header h1 {
  font-size: 1.5rem;
  margin: 0 0 0.25rem;
}

.listing-price.large {
  font-size: 1.3rem;
  font-weight: 600;
  color: #2a6f4b;
  margin: 0;
  white-space: nowrap;
}

.listing-facts.large {
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.listing-description,
.listing-features {
  margin-bottom: 2rem;
}

.listing-description h2,
.listing-features h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.listing-description p {
  line-height: 1.6;
  color: #333;
}

.listing-features dl {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr;
  gap: 0.4rem 1rem;
  font-size: 0.9rem;
}

.listing-features dt {
  color: #777;
}

.listing-features dd {
  margin: 0;
  color: #222;
}

.listing-source {
  font-size: 0.85rem;
  color: #888;
}

.login-page {
  max-width: 320px;
  margin: 15vh auto 0;
  padding: 2rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.login-page h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.login-page input[type="password"] {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.login-page input[type="submit"] {
  width: 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
}

.login-error {
  color: #c0392b;
  font-size: 0.9rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  background: #1a1a1a;
}

.site-nav a {
  color: #fff;
  font-size: 0.9rem;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav-logout {
  margin-left: auto;
  background: none;
  border: none;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.filter-save {
  font-size: 0.85rem;
  color: #1a73e8;
}

.saved-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.saved-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 8px;
  padding: 0.9rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.saved-search-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  flex: 1;
}

.saved-search-name {
  font-weight: 600;
}

.saved-search-actions {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: #c0392b;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.listing-new-badge {
  display: inline-block;
  background: #e2472e;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.listing-card-new {
  outline: 2px solid #e2472e;
  outline-offset: -2px;
}

.form-errors {
  background: #fdecea;
  color: #c0392b;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  flex-basis: 100%;
}
