:root { --primary: #2563eb; --bg: #f8fafc; }
body { font-family: 'Segoe UI', sans-serif; background: var(--bg); margin: 0; }
.app-header { background: white; padding: 15px 5%; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.container { max-width: 1000px; margin: 20px auto; }
.hidden { display: none !important; }

/* Form Card */
.form-card { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.coords-bar { background: #1e293b; color: #38bdf8; padding: 8px; font-size: 13px; border-radius: 0 0 12px 12px; text-align: center; }

/* Sketch Blueprint */
.sketch-area-label div, .sketch-dist-label div {
    white-space: nowrap; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Images */
.drop-zone { border: 2px dashed #cbd5e1; padding: 30px; text-align: center; color: #64748b; border-radius: 8px; cursor: pointer; }
.preview-grid { display: flex; gap: 10px; margin-top: 15px; overflow-x: auto; }
.preview-img { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; }

/* Grid */
/* --- Grid-ka Hantida --- */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 24px;
    padding: 10px 0;
}

/* --- Kaadhka Hantida ee Premium-ka ah --- */
/* --- Kaadhka Hantida ee Premium-ka ah --- */
.property-card {
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 235px !important; /* 👈 Aad baa loo soo koobay si booska loo badbaadiyo */
    height: auto !important;
}

/* Hover Effect */
.property-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}

.property-card:hover img {
    transform: scale(1.05);
}



.btn-add { background: var(--primary); color: white; border: none; padding: 10px 25px; border-radius: 8px; font-weight: 600; }
.btn-submit { background: #10b981; color: white; border: none; width: 100%; padding: 15px; border-radius: 8px; font-weight: bold; }

#detailSketch {
    /* Create a blueprint grid background */
    background-image: 
        linear-gradient(to right, #e5e7eb 1px, transparent 1px),
        linear-gradient(to bottom, #e5e7eb 1px, transparent 1px);
    background-size: 20px 20px;
}

.sketch-dist-label div {
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.1);
}

.img-thumbnail {
    transition: transform 0.2s;
    cursor: pointer;
}

.img-thumbnail:hover {
    transform: scale(1.05);
}
/* Professional Detail View Styles */
.detail-map-frame, .detail-sketch-frame {
    height: 400px;
    width: 100%;
    border-radius: 0 0 8px 8px;
}

.detail-sketch-frame {
    background-color: #fdfdfd;
    background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
    background-size: 20px 20px; /* Blueprint grid effect */
}

.price-tag {
    font-size: 2rem;
    font-weight: 800;
    color: #10b981;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.gallery-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.gallery-thumb:hover {
    filter: brightness(0.8);
}

.card {
    border-radius: 12px;
    overflow: hidden;
}

.sketch-dist-label div {
    background: white;
    border: 1.5px solid #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 11px;
}
/* Modern Design Overrides */
.detail-header {
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1.5rem;
}

.price-tag {
    font-size: 2.2rem;
    font-weight: 800;
    color: #059669; /* Emerald Green */
    letter-spacing: -1px;
}

.info-label {
    color: #64748b;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    color: #1e293b;
    font-weight: 700;
}

.spec-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.spec-card:hover {
    border-color: var(--primary);
}

.badge-available {
    background-color: #d1fae5;
    color: #065f46;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
}

.contact-card {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 16px;
    color: white;
}
/* Premium Header Container */
.detail-header-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Status Pill */
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.status-available {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #10b98133;
}

.status-sold {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #ef444433;
}

/* Refined Price Section */
.price-showcase {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 16px;
    min-width: 200px;
    text-align: right;
    border: 1px solid #f1f5f9;
}

.price-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.price-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #059669;
    line-height: 1;
}
/* Premium Header Container */
.detail-header-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Glassmorphism Price Showcase */
.price-showcase {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 16px;
    min-width: 220px;
    text-align: right;
    border: 1px solid #f1f5f9;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.status-available { background:#ecfdf5; color:#059669; border:1px solid #10b98133; }
.status-sold { background:#fef2f2; color:#dc2626; border:1px solid #ef444433; }
/* Premium Header Container */
.premium-header {
    background: #ffffff;
    border: 1px solid #eef2f6;
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04);
}

/* Updated Status Pill */
.status-pill-modern {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
}

/* Floating Price Card */
.price-hero-card {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    padding: 1.5rem 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.price-hero-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.price-hero-value {
    font-size: 2.8rem;
    font-weight: 900;
    color: #059669;
    line-height: 1;
}
/* Ensure the Global Map container fills the available viewport height */
#globalMapView {
    height: calc(100vh - 100px); /* Adjust based on your header height */
    width: 100%;
    position: relative;
}

#allPropertiesMap {
    height: 100%;
    width: 100%;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Modern Floating Back Button Design */
.btn-back-modern {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000; /* Ensure it stays above the Leaflet map */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid #e2e8f0;
    color: #1e293b;
    padding: 8px 20px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.btn-back-modern:hover {
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    color: #2563eb;
}
/* Map Price Tags */
.map-price-tag span {
    background-color: #dc2626; /* Red like your reference image */
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    border: 1.5px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Change color for available properties if preferred */
.map-price-tag.available span {
    background-color: #2563eb; /* Blue */
}

/* Ensure popups look clean */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 5px;
}
#panoramaViewer {
    height: 500px !important; /* Larger view for immersive feel */
    width: 100%;
    background-color: #000;
    border-radius: 0 0 16px 16px;
    position: relative;
    cursor: grab;
}

#panoramaViewer:active {
    cursor: grabbing;
}

/* Muuqaalka 360° si uu u buuxiyo card-ka dacal ilaa dacal */
.sd-panorama-card {
    overflow: hidden; /* Si geesaha hoose ee panorama-ha ay u raacaan wareegga card-ka */
}

.sd-panorama-card .sd-card-body {
    padding: 0 !important; /* Meesha ka saar padding-ka dhibka keenaya */
}

#panoramaViewer {
    width: 100% !important;
    height: 450px !important; /* Waxaad ka dhigi kartaa dhererka aad rabto */
    border: none !important;
    border-radius: 0 0 18px 18px; /* Si ay u wareegsanadaan geesaha hoose */
}

/* Customizing Pannellum buttons to look more like Google */
.pnlm-controls-container {
    background: rgba(0, 0, 0, 0.4) !important;
    border-radius: 4px !important;
}

.pnlm-zoom-controls {
    border: none !important;
}

/* Ensure the Pannellum container itself isn't being squashed */
.pnlm-container {
    background-color: #000 !important;
}
/* ════════════════════════════════════════════
   SHOW DETAILS — PREMIUM REDESIGN
   ════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ── Outer wrap ── */
.sd-wrap {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #f1f5f9;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ── Qaybta Sare ee Sawirka (Hero Container) ── */
.sd-hero {
    position: relative;
    width: 100%;
    height: auto !important;
    overflow: hidden;
    background: #0f172a;
    
    /* Geesaha sare oo kaliya ha wareegsanaadaan, geesaha hoose waa toos (0) */
    border-radius: 24px 24px 0 0 !important; 
}

/* ── Sawirka dhexdiisa ku jira ── */
.sd-hero img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center !important;
    
    /* Hubi in geesaha hoose ee sawirka laftoodu aysan wareegsanayn */
    border-radius: 24px 24px 0 0 !important;
}

/* ── Qaybta Asalka Cad ee Macluumaadka (G4 & Qiimaha) ── */
.property-title-bar {
    background: #ffffff !important;
    margin-top: 0 !important; /* Toos ugu dheji cidhifka sawirka */
    padding: 24px 24px !important; /* Boos neefsasho oo siman dhinacyada iyo dhexda */
    
    /* Geesaha sare waa toos (0) si ay sawirka ula midmaan, geesaha hoosena ha wareegsanaadaan */
    border-radius: 0 0 24px 24px !important; 
    
    /* Xuduudaha kaadhka si uu u yeesho xariiq dhuuban oo bilic leh */
    border-left: 1px solid #e2e8f0 !important;
    border-right: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    
    box-sizing: border-box !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}
.sd-hero:hover img { transform: scale(1); }
.sd-hero-grad {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.08) 0%,
    rgba(0,0,0,.18) 40%,
    rgba(0,0,0,.72) 100%);
  pointer-events: none;
}

/* Top badges row */
.sd-hero-top {
  position: absolute; top: 24px; left: 28px;
  display: flex; align-items: center; gap: 10px; z-index: 5;
}
.sd-status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 16px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.sd-available { background: rgba(16,185,129,.18); color: #6ee7b7; border: 1px solid rgba(16,185,129,.35); }
.sd-sold      { background: rgba(239,68,68,.18);  color: #fca5a5; border: 1px solid rgba(239,68,68,.35);  }
.sd-dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: sd-pulse 1.8s ease-in-out infinite;
}
@keyframes sd-pulse {
  0%,100%{ opacity:1; transform:scale(1); }
  50%    { opacity:.4; transform:scale(1.5); }
}
.sd-doc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.25); color: #fff;
  font-size: 11px; font-weight: 600; padding: 5px 12px; border-radius: 8px;
}

/* Bottom caption */
.sd-hero-caption {
  position: absolute; bottom: 36px; left: 32px; right: 260px; z-index: 5;
}
.sd-title {
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 800; color: #fff; line-height: 1.1; margin: 0 0 10px;
  text-shadow: 0 2px 16px rgba(0,0,0,.5);
}
.sd-location {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  font-size: 14px; color: rgba(255,255,255,.82);
}
.sd-location strong { color: #fff; }
.sd-loc-sep { color: rgba(255,255,255,.35); font-size: 18px; }

/* Floating price glass */
.sd-price-glass {
  position: absolute; bottom: 32px; right: 28px; z-index: 5;
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px; padding: 18px 26px; text-align: right;
  min-width: 180px;
}
.sd-price-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.55); margin-bottom: 4px;
}
.sd-price-value {
  font-family: 'Sora', sans-serif;
  font-size: 2.2rem; font-weight: 800; color: #fff; line-height: 1;
}

/* ── Thumbnail strip ── */
.sd-thumb-strip {
    background: transparent !important;
    padding: 16px 4px !important;
    margin-top: 4px !important;
}
.sd-thumb-strip::-webkit-scrollbar { display: none; }
.sd-thumb {
  flex-shrink: 0; width: 88px; height: 60px;
  object-fit: cover; border-radius: 9px;
  border: 2px solid transparent; cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.sd-thumb:hover {
  border-color: #2563eb; transform: translateY(-2px);
}

/* ── Content grid ── */
.sd-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  max-width: 100%; /* Waxaa maamulaya hadda container-ka weyn ee sare */
  margin: 15px 0 0 0;
  padding: 0;
}
.property-title-bar, .sd-thumb-strip, .sd-panorama-wide-container {
  max-width: 100% !important;
  margin: 0 !important;
}


@media (max-width: 960px) {
  .sd-grid { grid-template-columns: 1fr; }
  .sd-hero-caption { right: 28px; }
  .sd-price-glass { position: relative; bottom: auto; right: auto; margin: 16px 28px 0; text-align: left; }
}

/* ── Cards ── */
.sd-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  margin-bottom: 20px;
}
.sd-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid #f1f5f9;
}
.sd-icon-ring {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.sd-card-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #64748b;
}
.sd-card-body { padding: 20px; }

/* GPS bar */
.sd-gps-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #f8fafc; border-top: 1px solid #e2e8f0; padding: 11px 20px;
}
.sd-gps-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #94a3b8;
}
.sd-gps-code {
  font-size: 13px; font-weight: 700; color: #2563eb;
  background: #eff6ff; padding: 4px 10px; border-radius: 7px;
}

/* Blueprint sketch bg */
.sd-sketch-bg {
    background-color: #ffffff !important;
    background-image: none !important;
}
.sd-sketch-label {
  background: #fff; border: 1.5px solid #1e293b;
  padding: 2px 7px; border-radius: 5px;
  font-size: 11px; font-weight: 700; color: #1e293b;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
  white-space: nowrap;
}

/* ── Metrics ── */
.sd-metrics {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden;
  margin-bottom: 0;
}
.sd-metric {
  flex: 1; padding: 18px 14px; text-align: center;
}
.sd-metric-divider {
  width: 1px; background: #e2e8f0; flex-shrink: 0;
}
.sd-metric-val {
  font-family: 'Sora', sans-serif;
  font-size: 1.9rem; font-weight: 800; color: #0f172a; line-height: 1;
}
.sd-metric-val sup {
  font-size: .95rem; font-weight: 600; color: #64748b; vertical-align: super;
}
.sd-metric-area { font-size: 1.7rem; color: #2563eb; }
.sd-metric-key {
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #94a3b8; margin-top: 5px;
}

/* ── Feature rows ── */
.sd-feat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0; border-bottom: 1px solid #f1f5f9;
}
.sd-feat-label {
  font-size: 13px; color: #64748b; font-weight: 500;
  display: flex; align-items: center; gap: 7px;
}
.sd-badge {
  font-size: 11.5px; font-weight: 700; padding: 4px 13px;
  border-radius: 999px; letter-spacing: .02em;
}
.sd-badge-yes     { background: #dcfce7; color: #15803d; }
.sd-badge-no      { background: #f1f5f9; color: #64748b; }
.sd-badge-neutral { background: #fef9c3; color: #a16207; }

/* Building details box */
.sd-building-box {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 11px; padding: 12px 14px; margin: 8px 0 4px;
}
.sd-building-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #15803d; margin-bottom: 4px;
}
.sd-building-val {
  font-size: 13px; font-weight: 600; color: #1e293b;
}

/* ── Owner card ── */
.sd-owner-card {
  background: linear-gradient(140deg, #0f172a 0%, #1e3a8a 100%);
  border-radius: 18px; padding: 26px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.sd-owner-card::before {
  content: '';
  position: absolute; top: -50px; right: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(251,191,36,.08);
}
.sd-owner-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #fbbf24; margin-bottom: 6px;
}
.sd-owner-name {
  font-family: 'Sora', sans-serif;
  font-size: 1.45rem; font-weight: 800; color: #fff; margin-bottom: 20px; line-height: 1.2;
}
.sd-call-btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 14px; border-radius: 13px;
  background: #fbbf24; color: #1e293b; font-weight: 800; font-size: 15px;
  text-decoration: none; border: none; cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 18px rgba(251,191,36,.3);
}
.sd-call-btn:hover {
  background: #f59e0b; transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(251,191,36,.4);
  color: #1e293b;
}
/* ════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE DESIGN
   Dalaal App — Full Mobile Optimization
   ════════════════════════════════════════════ */

/* ── Base mobile resets ── */
@media (max-width: 768px) {

  /* ── Header ── */
  .app-header {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 999;
    background: #fff;
    box-shadow: 0 1px 12px rgba(0,0,0,0.08);
  }

  .app-header h1 {
    font-size: 1.25rem;
    margin: 0;
  }

  .app-header > div {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #showGlobalMapBtn {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
  }

  .btn-add {
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
  }

  /* ── Container ── */
  .container {
    padding: 12px 12px;
    margin: 0 auto;
  }

  /* ── Property Grid: 1 column on mobile ── */
  .property-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

  /* ── Property Card ── */
  .property-card {
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s;
  }

  .property-card:active {
    transform: scale(0.98);
  }

  /* ── Form Card ── */
  .form-card {
    padding: 16px 14px;
    border-radius: 0;
    box-shadow: none;
    margin: 0 -12px;
  }

  .form-header-modern {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start !important;
  }

  .form-header-modern h2 {
    font-size: 1.2rem !important;
  }

  .form-header-modern p {
    font-size: 0.8rem;
  }

  #backToList {
    align-self: flex-start;
  }

  /* ── Form rows: stack on mobile ── */
  .row.g-3 .col-md-6,
  .row.g-3 .col-md-4,
  .row.g-3 .col-md-3 {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }

  .row.g-3 {
    --bs-gutter-x: 0.75rem;
    --bs-gutter-y: 0.75rem;
  }

  /* ── Map container ── */
  .map-container {
    margin: 0 -2px;
  }

  #map {
    height: 280px !important;
    border-radius: 10px !important;
  }

  .coords-bar {
    font-size: 11px;
    padding: 6px 10px;
  }

  /* ── GPS input row ── */
  .input-group {
    gap: 0;
  }

  #applyGPS {
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    padding: 8px 14px;
  }

  /* ── Sketch ── */
  #sketchCanvas {
    height: 280px !important;
  }

  /* ── Drop zone ── */
  .drop-zone {
    padding: 20px 16px;
    font-size: 13px;
  }

  /* ── Preview grid ── */
  .preview-grid {
    gap: 8px;
    flex-wrap: wrap;
  }

  .preview-img {
    width: 85px;
    height: 85px;
  }

  /* ── Submit button ── */
  .btn-submit {
    padding: 16px;
    font-size: 15px;
    border-radius: 12px;
    position: sticky;
    bottom: 16px;
    box-shadow: 0 8px 24px rgba(16,185,129,0.35);
  }

  /* ── Global Map View ── */
  #globalMapView {
    height: calc(100vh - 60px);
    padding: 0;
  }

  #allPropertiesMap {
    border-radius: 0;
    border: none;
  }

  .btn-back-modern {
    top: 12px;
    left: 12px;
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 10px;
  }

  /* ── Details view ── */
  #detailsView > div:first-child {
    padding: 12px 14px 0 !important;
  }

  #backToListFromDetails {
    font-size: 13px;
    padding: 6px 14px;
  }

  /* ── Hero section ── */
  .sd-hero {
    height: 300px !important; /* Mobilada wuxuu noqonayaa 300px oo nadiif ah */
    border-radius: 0;
  }

  .sd-hero-caption {
    left: 16px;
    right: 16px;
    bottom: 100px;
  }

  .sd-title {
    font-size: 1.5rem !important;
  }

  .sd-location {
    font-size: 12px;
  }

  /* Price glass floats below on mobile */
  .sd-price-glass {
    position: absolute !important;
    bottom: 16px !important;
    right: 16px !important;
    left: auto;
    padding: 12px 18px;
    min-width: 130px;
    border-radius: 14px;
  }

  .sd-price-value {
    font-size: 1.6rem;
  }

  .sd-hero-top {
    top: 14px;
    left: 14px;
    gap: 8px;
  }

  /* ── Thumbnail strip ── */
  .sd-thumb-strip {
    padding: 10px 14px;
    gap: 6px;
  }

  .sd-thumb {
    width: 68px;
    height: 48px;
    border-radius: 7px;
  }

  /* ── Content grid: single column ── */
  .sd-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
    margin: 16px auto 0;
    padding: 0 12px;
  }

  /* ── SD Cards ── */
  .sd-card {
    border-radius: 14px;
    margin-bottom: 14px;
  }

  .sd-card-body {
    padding: 14px;
  }

  .sd-card-head {
    padding: 12px 14px;
  }

  /* ── Metrics strip ── */
  .sd-metrics {
    border-radius: 12px;
  }

  .sd-metric {
    padding: 14px 8px;
  }

  .sd-metric-val {
    font-size: 1.4rem;
  }

  .sd-metric-key {
    font-size: 9px;
  }

  /* ── Feature rows ── */
  .sd-feat-row {
    padding: 11px 0;
  }

  .sd-feat-label {
    font-size: 12px;
  }

  .sd-badge {
    font-size: 10.5px;
    padding: 3px 10px;
  }

  /* ── Owner card ── */
  .sd-owner-card {
    padding: 20px 18px;
    border-radius: 16px;
    margin-bottom: 14px;
  }

  .sd-owner-name {
    font-size: 1.2rem;
    margin-bottom: 14px;
  }

  .sd-call-btn {
    padding: 13px;
    font-size: 14px;
    border-radius: 12px;
  }

  /* ── Detail map & sketch ── */
  .detail-map-frame,
  .detail-sketch-frame {
    height: 260px;
  }

  /* ── GPS bar ── */
  .sd-gps-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
  }

  .sd-gps-code {
    font-size: 11px;
  }

  /* ── Panorama viewer ── */
  #panoramaViewer {
    height: 260px !important;
    border-radius: 0 0 14px 14px;
  }

  /* ── Status pill ── */
  .sd-status-pill {
    font-size: 10px;
    padding: 4px 12px;
  }

  .sd-doc-badge {
    font-size: 10px;
    padding: 4px 10px;
  }

  /* ── Section headings in form ── */
  h5.fw-bold.border-bottom {
    font-size: 0.95rem;
    margin-top: 8px;
  }

  /* ── Inputs: slightly larger tap targets ── */
  .form-control,
  .form-select,
  select.form-control {
    font-size: 15px;
    padding: 10px 12px;
    border-radius: 10px;
  }

  textarea.form-control {
    min-height: 90px;
  }

  /* ── Checkboxes ── */
  .form-check {
    padding: 10px 0 10px 28px;
  }

  .form-check-input {
    width: 1.2em;
    height: 1.2em;
  }

  /* ── Upload status ── */
  #uploadStatus {
    font-size: 13px;
  }

  /* ── Gallery grid in details ── */
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .gallery-thumb {
    height: 70px;
    border-radius: 8px;
  }

  /* ── Building box ── */
  .sd-building-box {
    padding: 10px 12px;
  }

  .sd-building-val {
    font-size: 12px;
  }
}

/* ── Extra small screens (< 400px) ── */
@media (max-width: 400px) {
  .app-header h1 { font-size: 1.1rem; }
  #showGlobalMapBtn { display: none; } /* hide on very small screens, show via menu instead */
  .sd-hero { height: 250px; }
  .sd-metrics { flex-wrap: wrap; }
  .sd-metric { flex: 0 0 50%; }
  .sd-metric-divider { display: none; }
  .sd-price-glass { min-width: 110px; padding: 10px 14px; }
  .sd-price-value { font-size: 1.35rem; }
}

/* ── Tablet range (769px–960px) ── */
@media (min-width: 769px) and (max-width: 960px) {
  .property-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .sd-grid {
    grid-template-columns: 1fr;
  }

  .sd-hero { height: 380px; }

  .sd-hero-caption {
    right: 28px;
    bottom: 28px;
  }

  .sd-price-glass {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    margin: 12px 28px 0;
    text-align: left;
    display: inline-block;
  }

  .form-card { padding: 22px 20px; }
}

/* ── Safe area insets for notched devices ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .btn-submit {
    margin-bottom: env(safe-area-inset-bottom);
  }
  .app-header {
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .filters-bar {
    padding-top: 0 !important;
  }
}

/* ── Smooth touch scrolling everywhere ── */
* {
  -webkit-overflow-scrolling: touch;
}

/* ════════════════════════════════════════════
   MOBILE TAB BAR — Bottom Navigation
   ════════════════════════════════════════════ */

/* Hide tab bar on desktop */
.mobile-tab-bar { display: none; }

@media (max-width: 992px) {

    /* ── Bottom Tab Bar ── */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1100;
        background: #ffffff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.10);
        height: 64px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        background: none;
        border: none;
        padding: 8px 0;
        font-size: 10px;
        font-weight: 700;
        color: #94a3b8;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        transition: color 0.2s ease, background 0.2s ease;
        cursor: pointer;
        position: relative;
    }

    .mobile-tab i {
        font-size: 20px;
        transition: transform 0.2s ease;
    }

    .mobile-tab.active {
        color: #2563eb;
    }

    .mobile-tab.active i {
        transform: translateY(-2px);
    }

    .mobile-tab.active::after {
        content: '';
        position: absolute;
        top: 0;
        left: 20%;
        right: 20%;
        height: 3px;
        background: #2563eb;
        border-radius: 0 0 4px 4px;
    }

    .mobile-tab:active {
        background: #f1f5f9;
    }

    /* ── Add bottom padding so content clears the tab bar ── */
    #listView,
    #detailsView,
    #formView,
    #globalMapView {
        padding-bottom: 64px !important;
    }

    /* ── Reset the column-reverse stacking to use tabs instead ── */
    #listView > div[style*="display: flex"] {
        flex-direction: column !important;
        height: auto !important;
    }

    /* ── Map panel: full viewport, below header+filters, hidden by default ── */
    #mainAppMapContainer {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 64px !important;
        height: auto !important;
        width: 100vw !important;
        z-index: 900;
        display: none;
        background: #cbd5e1;
    }

    #mainAppMapContainer.tab-visible {
        display: block !important;
        visibility: visible !important;
        height: 100% !important; /* Wuxuu ku xisaabtamayaa dhererkii JS-ka */
    }

    #mainMap {
        height: 100% !important;
        width: 100% !important;
        position: absolute !important;
        inset: 0 !important;
    }

    /* Ka ilaali bogga guud inuu yeesho scroll labaad marka map-ku furantahay */
    body.map-tab-active {
        overflow: hidden !important;
        height: 100vh !important;
    }


    #mainAppMapContainer.tab-visible #mainMap {
        position: absolute !important;
        inset: 0 !important;
        height: 100% !important;
        width: 100% !important;
    }

    /* When map tab is active, filters bar sits above the map */
    body.map-tab-active .filters-bar {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 950 !important;
        border-bottom: 1px solid #e2e8f0 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
    }

    

    /* ── List panel: full scroll, hidden when map tab active ── */
    #mainAppGridContainer {
        width: 100% !important;
        height: auto !important;
        overflow-y: visible !important;
        border-left: none !important;
        padding: 16px 14px !important;
    }

    #mainAppGridContainer.tab-hidden {
        display: none !important;
    }

    /* ── Filters bar: stay visible on list tab ── */
    .filters-bar {
        position: sticky !important;
        top: 0;
        z-index: 800;
        background: #ffffff !important;
    }

    /* ── Reset overflow on body & html for mobile ── */
    html, body {
        height: auto !important;
        overflow: auto !important;
    }

    #listView {
        height: auto !important;
        overflow: visible !important;
        display: block !important;
    }

    /* ── Details and Form views: full-screen, no split ── */
    #detailsView {
        height: auto !important;
        overflow-y: auto !important;
        min-height: 100vh;
    }
}

/* ── Leaflet popup: mobile-friendly size ── */
@media (max-width: 768px) {
  .leaflet-popup-content-wrapper {
    max-width: 200px;
    font-size: 12px;
  }

  .leaflet-popup-content {
    margin: 10px 12px;
  }
}
.building-row {
    animation: fadeIn 0.25s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Badhanka Custom-ka ah ee Fullscreen --- */
.custom-fullscreen-btn {
    background: #ffffff;
    width: 34px !important;
    height: 34px !important;
    border-radius: 4px;
    border: 2px solid rgba(0,0,0,0.2);
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    transition: background-color 0.2s;
}

.custom-fullscreen-btn:hover {
    background-color: #f4f4f4;
}

.custom-fullscreen-btn i {
    font-size: 16px !important;
    color: #334155 !important;
    font-weight: bold !important;
}

/* --- Split Screen Grid Layout (Laba Tiir) --- */
.split-property-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 👈 KAN CUSUB: Ku qasbaya laba tiir oo siman */
    gap: 14px !important;
    width: 100%;
}

/* Kaadhka loogu talagalay sanduuqa labada tiir ah */
.split-property-grid .property-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100% !important;
    min-height: 250px !important; /* Dherer ku habboon labada tiir */
    display: flex;
    flex-direction: column;
}

.split-property-grid .property-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}

/* Marka la joogo Shaashadaha Mobilada (Responsive Setup) */
@media (max-width: 992px) {
    #listView > div {
        flex-direction: column-reverse !important;
        height: auto !important;
    }
    #mainAppMapContainer {
        width: 100% !important;
        height: 400px !important;
    }
    #mainAppGridContainer {
        width: 100% !important;
        height: auto !important;
        overflow-y: visible !important;
    }
    .split-property-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* Mobilada laba tiir u daa maadaama uu balacu noqonayo 100% */
    }
}

@media (max-width: 576px) {
    .split-property-grid {
        grid-template-columns: 1fr !important; /* Mobilada yaryar ka dhig hal tiir */
    }
}

@media (max-width: 1200px) {
    #mainAppGridContainer {
        width: 450px !important; /* Wax yar u yaree shaashadaha dhex-dhexaadka ah */
    }
    .split-property-grid {
        grid-template-columns: 1fr !important; /* U baddal hal tiir haddii shaashadu cariiri noqoto */
    }
}

#mainAppMapContainer {
    flex: 1;
    height: 100%;
    position: relative;
    background-color: #cbd5e1; /* Midab yar oo caawinaad ah inta map-ku dhalanayo */
}

#mainMap {
    height: 100% !important;
    width: 100% !important;
}

/* --- KA SAARIDDA SCROLLBAR-TA GUUD EE BROWSER-KA --- */
@media (min-width: 993px) {
    html, body {
        height: 100vh !important;
        overflow: hidden !important; /* Wuxuu ku qasbaa biraawsarka inuu qariyo scrollbar-ta guud */
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hubi in container-ka weyn ee app-ka dhexdiisa uusan lahaan margin dhalato */
    #listView {
        height: calc(100vh - 70px) !important;
        overflow: hidden !important;
    }

    /* ════════════════════════════════════════════
       1. Qaabka Liiska Keliya (List Only Mode)
       ════════════════════════════════════════════ */
    body.view-list-only #mainAppMapContainer {
        display: none !important; /* Qari Map-ka */
    }
    body.view-list-only #mainAppGridContainer {
        width: 100% !important; /* Liisku ha buuxiyo shaashadda */
        height: 100% !important; /* Buuxi dhererka halkan */
        overflow-y: auto !important; /* 👈 CRITICAL FIX: Kici scroll-ka halkan si aad hoos u degi karto! */
    }
    body.view-list-only .split-property-grid {
        grid-template-columns: repeat(4, 1fr) !important; /* Ka dhig 3 tiir maadaama boosku weynaaday */
        gap: 20px !important;
    }

    /* ════════════════════════════════════════════
       2. Qaabka Map-ka Keliya (Map Only Mode)
       ════════════════════════════════════════════ */
    body.view-map-only #mainAppGridContainer {
        display: none !important; /* Qari Liiska */
    }
    body.view-map-only #mainAppMapContainer {
        flex: 1 !important;
        width: 100% !important; /* Map-ku ha buuxiyo shaashadda */
        height: 100% !important;
    }

    /* ════════════════════════════════════════════
       3. Qaabka Isku-dhafka (Default Split Mode)
       ════════════════════════════════════════════ */
    body.view-split-mode #mainAppMapContainer {
        flex: 1 !important;
        display: block !important;
    }
    body.view-split-mode #mainAppGridContainer {
        width: 680px !important; /* Dib ugu soo celi cabbirkii hore */
        display: block !important;
        height: 100% !important;
        overflow-y: auto !important; /* Scroll-ka midigta ee caadiga ah */
    }
    body.view-split-mode .split-property-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* Labo tiir */
    }
}

/* Hubi in nidaamka scroll-ka ee boga uu ku saxan yahay dhererka cusub */
#listView {
    height: calc(100vh - 70px) !important;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

/* Meelaha yar yar ee badhannada Bootstrap dropdown-ka */
.btn-xs {
    padding: 2px 6px !important;
    font-size: 11px !important;
}

/* --- QURXINTA SCROLLBAR-TA YAR EE LIISKA MIDIGTA --- */
#mainAppGridContainer::-webkit-scrollbar {
    width: 6px; /* Aad u dhuuban oo bilicsan */
}

#mainAppGridContainer::-webkit-scrollbar-track {
    background: #f8fafc; 
}

#mainAppGridContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: 10px;
}

#mainAppGridContainer::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* 👈 KAN CUSUB: Ku qasab Details View inuu dhererka shaashadda qaato, iskuna scroll-garoo */
#detailsView {
    height: calc(100vh - 70px) !important; /* Dherer go'an oo la mid ah List View-ga */
    overflow-y: auto !important;           /* Wuxuu dib u kiciyaa scroll-ka dhexdiisa ah */
    background: #f8fafc;
}

/* Qurxinta scrollbar-ta yar ee details-ka dhexdiisa ah */
#detailsView::-webkit-scrollbar {
    width: 6px;
}
#detailsView::-webkit-scrollbar-track {
    background: #f8fafc;
}
#detailsView::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* --- Premium Price Filter Dropdown Styling --- */
.premium-price-dropdown {
    margin-top: 6px !important;
    animation: fadeInDropdown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.premium-filter-input:focus {
    background-color: #ffffff !important;
    border-color: #0066ff !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15) !important;
    color: #1e293b !important;
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   🎛️ NOOUISLIDER PREMIUM HANDLES FORCE DISPLAY
   ========================================================================== */
#priceSlider {
    height: 4px !important;
    border: none !important;
    background: #e2e8f0 !important;
    box-shadow: none !important;
    margin: 20px 10px 10px 10px !important;
    position: relative !important;
    display: block !important;
}

#priceSlider .noUi-connect {
    background: #0066ff !important;
}

/* Kani wuxuu ku khasbayaa labada dhibco inay dibadda u soo baxaan muuqdaanna */
#priceSlider .noUi-handle {
    width: 18px !important;
    height: 18px !important;
    background: #0066ff !important;
    border: 3px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 102, 255, 0.4) !important;
    cursor: pointer !important;
    
    /* Toosinta booska */
    position: absolute !important;
    top: -7px !important;
    z-index: 9999 !important; /* Had iyo jeer ka sarrayi wax kasta */
}

/* Ka saar xariiqyada asalka ah ee ku dhex jiray dhibcaha */
#priceSlider .noUi-handle::before,
#priceSlider .noUi-handle::after {
    display: none !important;
}

.noUi-target, .noUi-base, .noUi-origin {
    overflow: visible !important;
}

/* 📝 KU QASAB FORM-KA INUU DHAMMAAN SHAASHADDA BUUXIYO ISKUNA SCROLL-GAROO */
#addPropertyForm, #formView {
    height: calc(100vh - 70px) !important; /* Dherer go'an oo la mid ah Split View-ga */
    overflow-y: auto !important;           /* Dib u kici scroll-ka gudaha ah */
    background: #f8fafc;
    padding-bottom: 40px !important;       /* Boos yar oo neefsasho ah salka hoose */
}

/* Qurxinta scrollbar-ta yar ee form-ka dhexdiisa ah */
#addPropertyForm::-webkit-scrollbar, #formView::-webkit-scrollbar {
    width: 6px;
}
#addPropertyForm::-webkit-scrollbar-track, #formView::-webkit-scrollbar-track {
    background: #f8fafc;
}
#addPropertyForm::-webkit-scrollbar-thumb, #formView::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
/* --- Form View Force Display Setup --- */
#formView {
    width: 100% !important;
    height: calc(100vh - 72px) !important; /* Dhererka go'an ee ka dhiman Navbar-ka sare */
    overflow-y: auto !important;           /* U ogolaan foomka inuu dhexdiisa ka scroll-garoobo */
    background: #ffffff !important;        /* Hubi in asalku yahay caddaan nadiif ah */
    box-sizing: border-box !important;
    position: relative !important;
    padding: 24px !important;
}

/* Qurxinta scrollbar-ta dhuuban ee foomka dhexdiisa ah */
#formView::-webkit-scrollbar {
    width: 6px;
}
#formView::-webkit-scrollbar-track {
    background: #f8fafc;
}
#formView::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
/* ============================================================
   📱 MOBILE VIEW FIXES  (max-width: 768px)
   ============================================================ */

@media (max-width: 768px) {

  /* 1. Restore normal scrolling on body */
  html, body {
    height: auto !important;
    overflow: auto !important;
    overflow-x: hidden !important;
  }

  /* 2. Header: shrink title & stack buttons if needed */
  .app-header {
    padding: 10px 14px !important;
    gap: 8px;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .app-header h1 {
    font-size: 1.1rem !important;
    white-space: nowrap;
  }

  .app-header > div {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
  }

  .app-header .btn-outline-primary,
  .app-header .btn-add {
    padding: 6px 10px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  /* 3. List / detail views: let them scroll naturally */
  #listView {
    height: auto !important;
    overflow: visible !important;
    overflow-x: hidden !important;
    display: block !important;
    flex-direction: unset !important;
  }

  #detailsView {
    height: auto !important;
    overflow-y: visible !important;
  }

  #addPropertyForm,
  #formView {
    height: auto !important;
    overflow-y: visible !important;
    padding: 16px !important;
  }

  /* Price dropdown panel: full-width on mobile */
  #priceDropdownWrapper {
    position: static !important;
  }
  .premium-price-dropdown {
    position: fixed !important;
    top: auto !important;
    left: 14px !important;
    right: 14px !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 9999 !important;
    max-height: 75vh !important;
    overflow-y: auto !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18) !important;
  }

  /* 5. Property grid: single column */
  .property-grid,
  .split-property-grid {
    grid-template-columns: 1fr !important;
    padding: 10px 12px !important;
    gap: 14px !important;
  }

  /* 6. Cards: comfortable height */
  .property-card {
    min-height: auto !important;
  }

  /* 7. Split view columns: stack vertically */
  #mainAppMapContainer {
    width: 100% !important;
    height: 260px !important;
  }

  #mainAppGridContainer {
    width: 100% !important;
    height: auto !important;
    overflow-y: visible !important;
    padding: 10px 0 !important;
  }

  /* Map inside list view */
  #mainMap {
    height: 260px !important;
  }

  /* 8. Detail header card */
  .detail-header-card,
  .premium-header {
    padding: 1.2rem !important;
    border-radius: 14px !important;
  }

  .price-value {
    font-size: 1.8rem !important;
  }

  /* 9. Back button */
  .btn-back-modern {
    margin: 10px 12px !important;
    font-size: 13px !important;
  }

  /* 10. Form map */
  #map {
    height: 260px !important;
  }
}

/* ════════════════════════════════════════════
   MOBILE DETAILS VIEW — Scroll Fix
   ════════════════════════════════════════════ */
@media (max-width: 992px) {
    #detailsView {
        /* Override any conflicting rules */
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
    }

    /* Allow the inner content to be taller than the viewport */
    #detailsContent {
        min-height: 100%;
        width: 100%;
        overflow: visible !important;
    }

    /* Ensure the sd-wrap (inner content wrapper) doesn't clip itself */
    .sd-wrap {
        overflow: visible !important;
        min-height: 100%;
        padding-bottom: 80px !important;
    }

    /* The max-width container inside sd-wrap */
    .sd-wrap > div {
        overflow: visible !important;
    }
}

/* ════════════════════════════════════════════
   MOBILE DETAILS VIEW — Full-Width Layout Fix
   ════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Remove all side padding from the outer container ── */
    .sd-wrap > div[style*="max-width"] {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ── Hero: full bleed, no border-radius, shorter height ── */
    .sd-hero {
        height: 260px !important;
        border-radius: 0 !important;
        width: 100% !important;
    }

    .sd-hero img {
        border-radius: 0 !important;
        height: 100% !important;
        width: 100% !important;
        object-fit: cover !important;
    }

    /* ── Title bar: flush to edges, stack vertically ── */
    .property-title-bar {
        padding: 16px 16px !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .property-title-bar h1 {
        font-size: 1.6rem !important;
        margin: 0 0 4px 0 !important;
    }

    .property-title-bar > div:last-child {
        width: 100% !important;
        text-align: left !important;
        border-radius: 12px !important;
        padding: 10px 16px !important;
    }

    /* ── Thumbnail strip: flush padding ── */
    .sd-thumb-strip {
        padding: 10px 16px !important;
        display: flex !important;
        overflow-x: auto !important;
        gap: 8px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* ── Content grid: no side padding ── */
    .sd-grid {
        padding: 0 12px !important;
        margin-top: 12px !important;
        gap: 12px !important;
    }

    /* ── Cards: slight padding reduction ── */
    .sd-card-body {
        padding: 14px 14px !important;
    }

    /* ── Panorama wide container: no side padding ── */
    .sd-panorama-wide-container {
        max-width: 100% !important;
        margin: 12px 0 !important;
        padding: 0 12px !important;
    }

    /* ── Bottom padding so last card clears the screen ── */
    .sd-wrap {
        padding-bottom: 32px !important;
    }

    /* ── Owner card: full width ── */
    .sd-owner-card {
        margin: 0 !important;
    }

    /* ── Detail map: use full available width ── */
    #detailMap {
        height: 300px !important;
        width: 100% !important;
    }
}

/* ── Hero status & back button positioning on mobile ── */
@media (max-width: 768px) {
    .sd-hero-top {
        top: 14px !important;
        left: 58px !important;
    }

    #backToListFromHero {
        top: 12px !important;
        left: 12px !important;
    }

    /* Price block inside title bar: full width on mobile */
    .property-title-bar > div[style*="background: #f0fdf4"] {
        width: 100% !important;
        text-align: left !important;
        box-sizing: border-box !important;
    }
}

/* ═══════════════════════════════════════
   MOBILE FILTERS CHIP BUTTON
   ═══════════════════════════════════════ */
.mf-chip {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Sora', sans-serif;
    white-space: nowrap;
}
.mf-chip.active {
    background: #0066ff;
    border-color: #0066ff;
    color: #fff;
}
.mf-chip:hover:not(.active) {
    border-color: #0066ff;
    color: #0066ff;
}

/* ═══════════════════════════════════════
   SHOW/HIDE DESKTOP vs MOBILE FILTERS
   ═══════════════════════════════════════ */

/* Default (Desktop): filters-bar iyo buttons-row display flex */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.filters-buttons-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    /* Hide desktop selects — override any inline width/display styles */
    .desktop-filter-select,
    #filterNeighborhood,
    #filterSubDistrict,
    #filterLandType {
        display: none !important;
        width: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    /* Cabirka dropdown hidden on mobile (handled by panel) */
    #sizeDropdownWrapper {
        display: none !important;
    }

    /* Filters bar: 2-row layout, no extra top space */
    .filters-bar {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 10px 14px 10px 14px !important;
        margin: 0 !important;
        align-items: stretch !important;
    }

    /* Search row always full width, no top margin */
    .filters-search-row {
        width: 100% !important;
        margin-top: 0 !important;
    }

    /* Buttons row: Filters + Qiimaha side by side */
    .filters-buttons-row {
        display: flex !important;
        gap: 8px !important;
        width: 100% !important;
    }

    /* Show mobile filters button */
    #mobileFiltersBtn {
        display: inline-flex !important;
        flex: 1 !important;
    }

    /* Qiimaha button also flex */
    #priceDropdownWrapper {
        flex: 1 !important;
    }
    #priceDropdownWrapper > button {
        width: 100% !important;
    }
}

@media (min-width: 769px) {
    /* Hide mobile button on desktop */
    #mobileFiltersBtn {
        display: none !important;
    }
    #mobileFiltersOverlay,
    #mobileFiltersPanel {
        display: none !important;
    }
    /* On desktop, filters-buttons-row is just flex inline */
    .filters-buttons-row {
        display: contents !important;
    }
    .filters-search-row {
        flex: 1;
        min-width: 180px;
    }
}
/* ════════════════════════════════════════════
   TABLET FIX — 769px to 992px
   Marka shaashadu u dhaxeyso 769px - 992px,
   tabs-ku muuqdaan oo filters-ku si sax ah u shaqeeyaan
   ════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 992px) {

  /* 1. Header: ku hel baas degdeg ah, tab-yada ha maqnaadaan */
  .app-header {
    padding: 10px 16px !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background: white !important;
  }

  .app-header h1 {
    font-size: 1.15rem !important;
    white-space: nowrap !important;
  }

  /* Buttons container: muuji tab-yada, ha qarsan */
  .app-header > div {
    display: flex !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    align-items: center !important;
  }

  .app-header .btn-outline-primary,
  .app-header .btn-add {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 7px 12px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  /* 2. Filters bar: desktop style (side-by-side, not stacked) */
  .filters-bar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 16px !important;
  }

  /* Search row: take remaining space */
  .filters-search-row {
    flex: 1 !important;
    min-width: 160px !important;
    width: auto !important;
  }

  /* Buttons row: inline with search */
  .filters-buttons-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    width: auto !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
  }

  /* Show desktop selects (hidden by 768px rule but visible here) */
  .desktop-filter-select,
  #filterNeighborhood,
  #filterSubDistrict,
  #filterLandType {
    display: block !important;
    width: auto !important;
    min-width: 110px !important;
    overflow: visible !important;
    padding: 0.25rem 0.5rem !important;
  }

  /* Show size dropdown wrapper */
  #sizeDropdownWrapper {
    display: block !important;
  }

  /* Hide mobile filters button (not needed in tablet) */
  #mobileFiltersBtn {
    display: none !important;
  }

  /* Price dropdown: normal positioning */
  .premium-price-dropdown {
    position: absolute !important;
    left: auto !important;
    right: 0 !important;
    width: 340px !important;
    max-width: none !important;
    top: 100% !important;
  }

  /* 3. Property grid: 2 columns on tablet */
  .property-grid,
  .split-property-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    padding: 16px !important;
    gap: 16px !important;
  }

  /* 4. List/detail views: scroll naturally */
  #listView {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  /* 5. Split view: map on top, grid below */
  #mainAppMapContainer {
    width: 100% !important;
    height: 300px !important;
  }

  #mainAppGridContainer {
    width: 100% !important;
    height: auto !important;
    overflow-y: visible !important;
  }

  #mainMap {
    height: 300px !important;
  }
}

/* ==========================================================================
   🎛️ TABLET & IPAD MINI FIX (Ku darista 768px oo iPad Mini ah)
   ========================================================================== */
@media (min-width: 500px) and (max-width: 992px) { /* 👈 Halkan waxaa laga dhigay 768px */

  /* 1. Hubi in qaybta weyn ee liiska hantidu ay qaadato 100% baaxadda */
  #mainAppGridContainer {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    box-sizing: border-box !important;
  }

  /* 2. Ku qasab Grid-ka inuu u jabo 2 tiir oo sax ah oo siman */
  .property-grid,
  .split-property-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 👈 Labo tiir */
    gap: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 3. Habeynta Kaadhka si uu ula jaan-qaado labada tiir */
  .split-property-grid .property-card,
  .property-card {
    min-height: 280px !important; 
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    border: 1px solid #e2e8f0 !important;
  }

  /* 4. Xaddid dhererka sawirka si uusan kaadhka oo dhan u dherer-gariirin */
  .split-property-grid .property-card div[style*="height:"],
  .property-card div[style*="height:"] {
    height: 140px !important; /* Dherer go'an oo bilic leh */
    width: 100% !important;
  }

  .property-card img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
  }
}

/* ==========================================================================
   🗺️ CUSTOM MAP TYPE DROPDOWN DESIGN (Zillow Style)
   ========================================================================== */
.custom-map-type-dropdown {
    position: relative;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    margin-top: 10px !important;
    margin-right: 10px !important;
}

/* Badhanka weyn */
.map-type-btn {
    background: #ffffff !important;
    color: #2d3748 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    font-family: 'Segoe UI', sans-serif;
}

.map-type-btn:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
}

/* Menu-ga marka uu hoos u dhaco */
.map-type-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 160px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

.map-type-menu.show {
    display: flex !important; /* Waxaa kicisa JS */
}

/* Item-ka menu-ga dhexdiisa ah */
.map-type-item {
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}

.map-type-item:hover {
    background: #f1f5f9;
    color: #1a0dab;
}

/* Marka qaabka la doorto uu active yahay */
.map-type-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 700;
}