/* QRO MLS — Mini App Styles */
:root {
  --green: #1B4D3E;
  --green-light: #256352;
  --gold: #C9A84C;
  --gold-light: #DFB96A;
  --white: #FFFFFF;
  --bg: #F5F5F0;
  --card-bg: #FFFFFF;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 20px;
}

/* Header */
.header {
  background: var(--green);
  color: var(--white);
  padding: 16px 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 11px;
  opacity: 0.7;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Deal type toggle */
.deal-toggle {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 14px;
}

.deal-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.deal-btn.active {
  background: var(--gold);
  color: var(--white);
  font-weight: 600;
}

/* City filter */
.city-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 14px;
  scrollbar-width: none;
}

.city-filter::-webkit-scrollbar { display: none; }

.city-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  background: transparent;
}

.city-pill.active {
  background: var(--white);
  border-color: var(--white);
  color: var(--green);
  font-weight: 600;
}

/* Search bar */
.search-bar {
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--green);
  background: var(--white);
}

/* Listings grid */
.listings {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.listings-count {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 16px 0;
  margin-top: 12px;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:active { transform: scale(0.98); }

.card-gallery {
  position: relative;
  height: 200px;
  background: #E5E5E5;
  overflow: hidden;
}

.card-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, #1B4D3E22, #C9A84C22);
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  background: var(--green);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-badge.rent { background: var(--gold); color: var(--white); }

.card-body {
  padding: 14px;
}

.card-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}

.card-type {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.card-city {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.card-params {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card-param {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Loading/empty */
.loading {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Detail modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-gallery {
  position: relative;
  height: 260px;
  background: #E5E5E5;
  overflow: hidden;
}

.modal-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-gallery-nav {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: background 0.2s;
}

.gallery-dot.active { background: var(--white); }

.gallery-prev, .gallery-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.modal-no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: linear-gradient(135deg, #1B4D3E22, #C9A84C22);
}

.modal-content {
  padding: 20px 16px 32px;
}

.modal-price {
  font-size: 26px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}

.modal-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-city {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-params-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.modal-param {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}

.modal-param-icon { font-size: 20px; margin-bottom: 4px; }
.modal-param-val { font-size: 15px; font-weight: 600; }
.modal-param-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.modal-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.modal-description {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 20px;
}

.modal-realtor {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.realtor-avatar {
  width: 40px;
  height: 40px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.realtor-info { flex: 1; }
.realtor-name { font-size: 14px; font-weight: 600; }
.realtor-label { font-size: 12px; color: var(--text-muted); }

.btn-contact {
  width: 100%;
  padding: 16px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-contact:active { background: var(--green-light); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.4);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Price filter */
.filter-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.filter-select {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  appearance: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--green); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  transition: transform 0.3s ease;
  white-space: nowrap;
}

.toast.show { transform: translateX(-50%) translateY(0); }
