/* Choose Villa - frontend styles */
.cv-wrapper,
.cv-wrapper * {
  box-sizing: border-box;
}

.cv-wrapper {
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: "FiraGO", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1a1a1a;
}

/* Map */
.cv-map-wrapper {
  position: relative;
  line-height: 0;
  width: 100%;
}
.cv-map {
  position: relative;
  width: 100%;
}
.cv-render {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.cv-plan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Houses */
.cv-house {
  fill: rgba(255, 255, 255, 0.25);
  stroke: #B3B258;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease;
}
.cv-house[data-status="sold"] {
  fill: rgba(208, 60, 60, 0.28);
  stroke: #D03C3C;
  cursor: default;
}
.cv-house[data-status="reserved"] {
  fill: rgba(232, 178, 60, 0.38);
  stroke: #E8B23C;
}
.cv-house:not([data-status="sold"]):not(.cv-disabled):hover,
.cv-house.cv-active {
  fill: rgba(179, 178, 88, 0.4);
}
.cv-house.cv-active {
  stroke: #B3B258;
}

/* Filtered-out houses: greyed, non-interactive */
.cv-house.cv-disabled {
  fill: rgba(180, 180, 180, 0.18) !important;
  stroke: #b5b5b5 !important;
  pointer-events: none;
  cursor: default;
}

/* Status text colors (shared) */
.cv-status-sold     { color: #C73E3E; }
.cv-status-reserved { color: #C8941A; }
.cv-status-available{ color: #4A8C5F; }

/* Tooltip (singleton, appended to body) */
.cv-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
  transform: translate(-9999px, -9999px);
  font-family: "FiraGO", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1a1a1a;
}
.cv-tooltip * { box-sizing: border-box; }
.cv-tooltip-inner {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 14px 16px;
  opacity: 0;
  transform: scale(0.94);
  transform-origin: top left;
  transition:
    opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.cv-tooltip.cv-visible .cv-tooltip-inner {
  opacity: 1;
  transform: scale(1);
}
.cv-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.cv-tooltip-title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cv-tooltip-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.cv-tooltip-type {
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  color: #5a5550;
}
.cv-tooltip-status {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}
.cv-tooltip-stats {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 24px;
  row-gap: 12px;
}

/* Stat (used in tooltip + info block) */
.cv-stat {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cv-stat-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}
.cv-stat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cv-stat-label {
  font-size: 8px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}
.cv-stat-value {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* Info block (mobile-only) */
.cv-info-block {
  display: none;
}

/* Mobile - explicit pixel sizing (1081:609 -> 710:400) so theme/builder rules can't distort it */
@media (max-width: 768px) {
  .cv-wrapper .cv-map-wrapper {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 5px;
    margin-bottom: 5px;
    border-radius: 0;
    scrollbar-color: #182721 #FFFFFF;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
  }
  .cv-wrapper .cv-map-wrapper::-webkit-scrollbar { height: 6px; }
  .cv-wrapper .cv-map-wrapper::-webkit-scrollbar-track {
    background: #FFFFFF;
    border-radius: 0;
  }
  .cv-wrapper .cv-map-wrapper::-webkit-scrollbar-thumb {
    background: #182721;
    border-radius: 0;
    border: 0;
  }
  .cv-wrapper .cv-map {
    display: block !important;
    width: 710px !important;
    height: 400px !important;
    max-width: none !important;
    min-width: 710px !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .cv-wrapper .cv-render {
    width: 710px !important;
    height: 400px !important;
    max-width: 710px !important;
    min-width: 710px !important;
    min-height: 400px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .cv-wrapper .cv-plan-overlay {
    width: 710px !important;
    height: 400px !important;
  }

  .cv-tooltip { display: none !important; }

  .cv-info-block {
    display: block;
    background: #ffffff;
    border-radius: 0;
    padding: 18px 20px;
    text-align: left;
  }
  .cv-info-block * { text-align: left; }
  .cv-info-status { text-align: right; }
  .cv-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 16px;
  }
  .cv-info-title-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .cv-info-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
  }
  .cv-info-type {
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: #5a5550;
  }
  .cv-info-status {
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
  }
  .cv-info-stats {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: space-between;
    gap: 16px 12px;
  }
  .cv-info-stats .cv-stat-icon { width: 24px; height: 24px; }
  .cv-info-stats .cv-stat-label { font-size: 10px; }
  .cv-info-stats .cv-stat-value { font-size: 13px; }

  .cv-info-link {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #724714;
    border-radius: 8px;
    background: transparent;
    color: #724714;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
  }
  .cv-info-link:hover {
    background: rgba(114, 71, 20, 0.08);
  }
  .cv-info-link svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
}

@media (min-width: 480px) and (max-width: 768px) {
  .cv-info-stats {
    grid-template-columns: repeat(4, auto);
  }
}
