/* ===== RentalRaja — Warm, Clean, Indian ===== */

:root {
  --primary: #E8590C;
  --primary-light: #F76707;
  --primary-dark: #D9480F;
  --accent: #2B8A3E;
  --accent-light: #37B24D;
  --blue: #1971C2;
  --red: #E03131;
  --bg: #F8F7F4;
  --surface: #FFFFFF;
  --surface-2: #F1F0EC;
  --surface-3: #E8E6E1;
  --text: #212529;
  --text-muted: #868E96;
  --text-light: #ADB5BD;
  --border: #E9ECEF;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; height: 100vh; }

/* ===== Top Bar ===== */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.logo span { color: var(--primary); }
.badge { background: var(--accent); color: white; font-size: 0.6rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; letter-spacing: 0.5px; }
.topbar-center { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stat-pill { background: var(--surface-2); color: var(--text); padding: 6px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; border: 1px solid var(--border); }
.filter-group { display: flex; gap: 6px; }
.filter-group select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 7px 10px; border-radius: 6px; font-size: 0.8rem; cursor: pointer;
}
.filter-group select:focus { outline: none; border-color: var(--primary); }

/* ===== Buttons ===== */
.btn-primary {
  background: var(--primary); color: white; border: none; padding: 9px 18px;
  border-radius: var(--radius); font-weight: 600; font-size: 0.85rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  padding: 9px 18px; border-radius: var(--radius); font-weight: 500; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }
.btn-large { padding: 14px 32px; font-size: 1.05rem; }

/* ===== Map ===== */
#map {
  position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
  z-index: 1; background: var(--bg);
}

/* Custom Marker */
.custom-marker {
  background: var(--primary); color: white; border-radius: 8px;
  padding: 4px 9px; font-size: 0.78rem; font-weight: 700;
  box-shadow: 0 2px 6px rgba(232, 89, 12, 0.25);
  white-space: nowrap; cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; gap: 4px;
}
.custom-marker::before {
  content: ''; display: inline-block; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 5px solid var(--primary); position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
}
.custom-marker:hover { transform: scale(1.08); box-shadow: 0 3px 12px rgba(232, 89, 12, 0.35); }
.custom-marker .marker-bhk { font-size: 0.65rem; opacity: 0.85; }

/* ===== Detail Panel ===== */
#detail-panel {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
  background: var(--surface); border-top-left-radius: 16px; border-top-right-radius: 16px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.1); max-height: 70vh; overflow-y: auto;
  transition: transform 0.25s ease; padding: 20px;
}
#detail-panel.hidden { transform: translateY(100%); }
.detail-close {
  position: absolute; top: 12px; right: 16px; background: var(--surface-2);
  color: var(--text-muted); border: none; width: 30px; height: 30px; border-radius: 50%;
  font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.detail-close:hover { color: var(--text); }
.detail-card { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-photos { grid-column: 1 / -1; }
.detail-photos img { width: 100%; height: 180px; object-fit: cover; border-radius: var(--radius); }
.detail-photos .no-photos { background: var(--surface-2); height: 140px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-muted); border: 1px dashed var(--border); }
.detail-info h3 { font-size: 1.1rem; margin-bottom: 6px; }
.detail-price { font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.detail-price span { font-size: 0.85rem; color: var(--text-muted); font-weight: 400; }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.detail-tag { background: var(--surface-2); padding: 3px 9px; border-radius: 5px; font-size: 0.72rem; color: var(--text-muted); border: 1px solid var(--border); }
.detail-desc { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; margin-top: 10px; grid-column: 1 / -1; }
.detail-contact { grid-column: 1 / -1; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.btn-call {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: white; border: none; padding: 10px 20px;
  border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  text-decoration: none; transition: all 0.15s; margin-right: 8px;
}
.btn-call:hover { background: var(--accent-light); }
.btn-whatsapp {
  display: inline-flex; align-items: center; gap: 6px;
  background: #25D366; color: white; border: none; padding: 10px 20px;
  border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  text-decoration: none; transition: all 0.15s;
}
.btn-whatsapp:hover { background: #128C7E; }

/* Share Button */
.btn-share-listing {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 10px 20px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  transition: all 0.15s; margin-left: 8px;
}
.btn-share-listing:hover { background: var(--surface-3); }

/* Area Banner */
.area-banner {
  position: fixed; top: 56px; left: 0; right: 0; z-index: 900;
  background: var(--primary); color: white; padding: 14px 24px;
  box-shadow: 0 3px 16px rgba(232, 89, 12, 0.2);
}
.area-banner-content {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1200px; margin: 0 auto; gap: 16px;
}
.area-banner-left h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.area-banner-left p { font-size: 0.85rem; opacity: 0.9; }
.area-banner-actions { display: flex; align-items: center; gap: 10px; }
.btn-share-area {
  background: white; color: var(--primary-dark); border: none; padding: 8px 16px;
  border-radius: 6px; font-weight: 600; font-size: 0.82rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-share-area:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn-close-banner {
  background: rgba(255,255,255,0.2); color: white; border: none; width: 28px; height: 28px;
  border-radius: 50%; font-size: 0.9rem; cursor: pointer;
}
.btn-close-banner:hover { background: rgba(255,255,255,0.35); }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); }
.modal-content {
  position: relative; background: var(--surface); border-radius: 16px;
  width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto; padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-header h2 { font-size: 1.05rem; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; }

/* Form */
.step-label { color: var(--primary); font-size: 0.78rem; font-weight: 600; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.helper { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 10px; }
.form-row { display: flex; gap: 10px; margin-bottom: 10px; }
.form-row input, .form-row select {
  flex: 1; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 9px 12px; border-radius: 6px; font-size: 0.88rem;
}
.form-row input:focus, .form-row select:focus, textarea:focus, input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.08);
}
textarea, input[type="text"], input[type="number"], input[type="tel"] {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 9px 12px; border-radius: 6px; font-size: 0.88rem; margin-bottom: 10px;
}
.location-picker {
  background: var(--surface-2); border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  border: 1px solid var(--border);
}
.coords-display { color: var(--text-muted); font-size: 0.78rem; margin-top: 6px; }
.coords-display.active { color: var(--accent); font-weight: 600; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; }
.photo-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.photo-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
input[type="file"] { display: block; }
.location-buttons { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.btn-detect {
  background: var(--accent); color: white; border: none; padding: 9px 14px;
  border-radius: 6px; font-weight: 600; font-size: 0.82rem; cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: all 0.15s;
}
.btn-detect:hover { background: var(--accent-light); }
.btn-detect:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-detect.loading { background: var(--surface-3); color: var(--text-muted); }
.btn-pick {
  background: var(--surface); color: var(--primary); border: 1px solid var(--primary);
  padding: 9px 14px; border-radius: 6px; font-weight: 600; font-size: 0.82rem; cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: all 0.15s;
}
.btn-pick:hover { background: var(--primary); color: white; }
.btn-pick.active { background: var(--primary); color: white; }
.or-divider { color: var(--text-light); font-size: 0.78rem; }
#pick-map-hint { color: var(--primary); font-weight: 600; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.form-nav { display: flex; justify-content: space-between; margin-top: 18px; }

/* Search Box */
.topbar-right { display: flex; align-items: center; gap: 8px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; font-size: 0.8rem; pointer-events: none; z-index: 1; }
#search-location {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 8px 12px 8px 30px; border-radius: 6px; font-size: 0.82rem;
  width: 200px; transition: all 0.2s;
}
#search-location:focus { outline: none; border-color: var(--primary); width: 260px; }
#search-location::placeholder { color: var(--text-light); }
.search-results {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; z-index: 1100;
}
.search-results.hidden { display: none; }
.search-result-item {
  padding: 9px 12px; cursor: pointer; font-size: 0.82rem;
  border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.search-result-item:hover { background: var(--surface-2); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item .result-name { color: var(--text); font-weight: 500; }
.search-result-item .result-sub { color: var(--text-muted); font-size: 0.72rem; margin-top: 1px; }

/* ===== Hero Overlay ===== */
#hero-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(248, 247, 244, 0.97);
  display: flex; align-items: center; justify-content: center;
}
#hero-overlay.hidden { display: none; }
.hero-content { text-align: center; max-width: 500px; padding: 20px; }
.hero-content h2 { font-size: 1.7rem; font-weight: 800; margin-bottom: 14px; line-height: 1.3; color: var(--text); }
.hero-content p { color: var(--text-muted); font-size: 1rem; margin-bottom: 8px; }
.hero-content .btn-primary { margin-top: 18px; }
.area-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.area-link {
  background: var(--surface); color: var(--primary); padding: 5px 12px;
  border-radius: 16px; font-size: 0.78rem; font-weight: 500;
  text-decoration: none; transition: all 0.15s; border: 1px solid var(--border);
}
.area-link:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: white; padding: 10px 22px; border-radius: var(--radius);
  font-weight: 500; font-size: 0.88rem; z-index: 4000; box-shadow: var(--shadow-lg);
}
.toast.hidden { display: none; }
.toast.error { background: var(--red); }

/* ===== Leaflet Overrides ===== */
.leaflet-control-zoom { border: none !important; }
.leaflet-control-zoom a {
  background: var(--surface) !important; color: var(--text) !important;
  border: 1px solid var(--border) !important; border-radius: 4px !important;
}
.leaflet-control-zoom a:hover { background: var(--surface-2) !important; }
.leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--surface); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  #topbar { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  .topbar-center { order: 3; width: 100%; overflow-x: auto; }
  .filter-group { gap: 4px; }
  .filter-group select { padding: 5px 6px; font-size: 0.72rem; }
  .detail-card { grid-template-columns: 1fr; }
  #detail-panel { max-height: 80vh; }
  .hero-content h2 { font-size: 1.3rem; }
  .stat-pill { font-size: 0.72rem; padding: 4px 10px; }
  .search-box { order: 4; width: 100%; }
  #search-location { width: 100%; }
  #search-location:focus { width: 100%; }
  .area-banner-content { flex-direction: column; text-align: center; }
  .area-banner-left h2 { font-size: 0.95rem; }
}
