* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Ropa Sans", sans-serif;
  background: #f7f5f1;
  color: #1d1d1d;
}

body {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: 320px;
  min-width: 320px;
  background: #033233;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  padding: 20px 16px;
  position: relative;
  z-index: 20;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
}

.brand-logo {
  width: 38px;
  height: auto;
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-family: "Belleza", sans-serif;
  font-size: 14px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.mobile-close-sidebar {
  display: none;
}

.sheet-handle-wrap {
  display: none;
}

.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  outline: none;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.reset-view-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: #d8aa7d;
  color: #033233;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: inherit;
}

.reset-view-btn:hover {
  background: #e5bb92;
}

.project-count {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 12px;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
}

.project-card {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: 0.2s ease;
}

.project-card:hover {
  transform: translateY(-1px);
  border-color: #d8aa7d;
  background: rgba(216, 170, 125, 0.08);
}

.project-card.active {
  border-color: #d8aa7d;
  background: rgba(216, 170, 125, 0.14);
}

.project-card h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #ffffff;
}

.project-meta {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.45;
}

.map-wrapper {
  flex: 1;
  min-width: 0;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

.custom-marker {
  width: 20px;
  height: 20px;
  background: #033233;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(3, 50, 51, 0.22),
    0 2px 10px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.custom-marker.is-hovered {
  background: #d8aa7d;
  box-shadow: 0 0 0 8px rgba(216, 170, 125, 0.28),
    0 4px 16px rgba(0, 0, 0, 0.28);
}

.custom-marker.is-bouncing {
  background: #d8aa7d;
  animation: markerPulse 1s infinite ease-in-out;
  box-shadow: 0 0 0 10px rgba(216, 170, 125, 0.32),
    0 6px 18px rgba(0, 0, 0, 0.32);
}

@keyframes markerPulse {
  0%,
  100% {
    box-shadow: 0 0 0 6px rgba(216, 170, 125, 0.22),
      0 4px 14px rgba(0, 0, 0, 0.24);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(216, 170, 125, 0.42),
      0 6px 18px rgba(0, 0, 0, 0.32);
  }
}

/* DESKTOP DETAIL PANEL */
.detail-panel {
  width: 390px;
  min-width: 390px;
  background: #ffffff;
  border-left: 1px solid #e7e1d8;
  overflow-y: auto;
  padding: 18px;
  z-index: 15;
}

.detail-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
}

.detail-empty h2 {
  margin: 0 0 8px;
  font-family: "Belleza", sans-serif;
  color: #033233;
}

.detail-empty p {
  margin: 0;
  color: #66615b;
  line-height: 1.5;
}

.detail-content {
  display: block;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-title-wrap {
  min-width: 0;
}

.detail-developer {
  margin: 0 0 4px;
  font-size: 12px;
  color: #8c7b66;
}

.detail-title {
  margin: 0 0 8px;
  font-family: "Belleza", sans-serif;
  font-size: 24px;
  line-height: 1.15;
  color: #033233;
}

.detail-meta {
  margin: 0 0 8px;
  font-size: 13px;
  color: #66615b;
  line-height: 1.45;
}

.detail-price {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #033233;
}

.detail-close-btn {
  border: none;
  background: #f4efe7;
  color: #033233;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

.detail-gallery {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-image-link {
  display: block;
  text-decoration: none;
}

.detail-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: linear-gradient(90deg, #d7d2cb 25%, #ebe7e1 50%, #d7d2cb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.detail-image.loaded {
  opacity: 1;
  animation: none;
  background: none;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.detail-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.detail-thumb {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.detail-thumb.active {
  border-color: #d8aa7d;
}

.detail-facts-wrap h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #033233;
}

.detail-facts {
  margin: 0 0 16px;
  padding-left: 18px;
}

.detail-facts li {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: #3c3c3c;
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-brochure-btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: #033233;
  color: #ffffff;
}

/* MOBILE UI */
.mobile-projects-toggle {
  display: none;
}

.mobile-sidebar-overlay {
  display: none;
}

.mobile-detail-overlay {
  display: none;
}

@media (max-width: 900px) {
  .app-layout {
    display: block;
  }

  .map-wrapper {
    width: 100%;
    height: 100vh;
  }

  #map {
    height: 100vh;
  }

  .detail-panel {
    display: none;
  }

  .mobile-projects-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 40;
    border: none;
    background: #033233;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    cursor: pointer;
  }

  .mobile-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 30;
  }

  .mobile-sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    min-width: 100%;
    max-height: 82vh;
    height: 82vh;
    border-right: none;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    transform: translateY(calc(100% - 96px));
    transition: transform 0.28s ease;
    padding: 10px 14px 18px;
    z-index: 35;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .sidebar.is-open {
    transform: translateY(0);
  }

  .sheet-handle-wrap {
    display: flex;
    justify-content: center;
    padding: 2px 0 10px;
    flex-shrink: 0;
    touch-action: none;
    cursor: grab;
  }

  .sheet-handle {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
  }

  .sidebar-header {
    align-items: center;
    margin-bottom: 12px;
    padding-right: 34px;
    flex-shrink: 0;
  }

  .brand-logo {
    width: 34px;
  }

  .brand-text h1 {
    font-size: 13px;
  }

  .brand-text p {
    font-size: 10px;
  }

  .mobile-close-sidebar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
  }

  .sidebar-tools {
    flex-shrink: 0;
    background: #033233;
    padding-bottom: 10px;
    margin-bottom: 8px;
  }

  .search-input,
  .reset-view-btn {
    font-size: 14px;
    padding: 12px 14px;
  }

  .project-count {
    font-size: 12px;
    margin-bottom: 10px;
    flex-shrink: 0;
  }

  .project-list {
    gap: 8px;
    padding-bottom: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    touch-action: pan-y;
  }

  .project-card {
    padding: 12px;
  }

  .project-card h3 {
    font-size: 14px;
  }

  .project-meta {
    font-size: 12px;
  }

  .mobile-detail-overlay {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.25s ease;
  }

  .mobile-detail-overlay.is-open {
    transform: translateX(0);
  }

  .mobile-detail-topbar {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #ece6dd;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .mobile-detail-back {
    border: none;
    background: #f4efe7;
    color: #033233;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-detail-body {
    padding: 16px 14px 24px;
    overflow-y: auto;
  }

  .mobile-gallery .detail-image {
    height: 220px;
  }

  .detail-title {
    font-size: 24px;
  }

  .detail-meta,
  .detail-price,
  .detail-facts li {
    font-size: 14px;
  }

  .detail-brochure-btn {
    font-size: 13px;
    padding: 12px 14px;
  }

  .mapboxgl-ctrl-top-right {
    top: 14px;
    right: 14px;
  }
}
