/* measurement.css */

/* Measurement Tool Styles */

/* Ruler Icon */
.icon-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-top: 60px;
  color: #010623;
  background-color: #fff;
  border-radius: 5px;
  width: 40px;
  height: 40px;
  display: grid;
  border: none;
  place-items: center;
  z-index: 1005;
  position: absolute;
  top: 3.75rem; /* Original desktop spacing */
  left: 1rem;
}

.icon-container svg {
  width: 21px;
  height: 21px;
}
.mobile-close-measurement {
  position: absolute;
  top: 15px;
  display: none;
}
.mobile-measurement-tools {
  position: relative;
  display: flex;
  justify-content: start;
  padding-left: 4px;
  align-items: center;
  flex-direction: row !important;
  cursor: pointer;
  margin-top: 60px;
  color: #010623;
  background-color: #fff;
  border-radius: 5px;
  width: 147px;
  height: 26px;
  position: absolute;
  border: solid #e1e2e6 1px;
  z-index: 1005;
}

.mobile-close-measurement-text {
  font-size: 12px;
  letter-spacing: 0.16px;
  line-height: 1;
  width: fit-content !important;
}

.mobile-close-icon {
  width: fit-content;
  margin-left: 4px;
}

.mobile-measurement-tools.active {
  background-color: #0085ff !important;
}
.mobile-measurement-tools.active svg path {
  fill: white !important;
}

/* .distance-mobile {

} */
.angle-mobile {
  top: 60px;
}
.area-mobile {
  top: 118px;
}

.distance-mobile svg {
  width: 30px;
  height: 30px;
}
/* Panorama Toggle - Active State (SVG) */
#panorama_toggle.active svg path {
  fill: #0085ff; /* Change SVG color */
}

/* Ruler Icon - Active State (SVG) */
#ruler-icon.active svg path {
  fill: #fff; /* Change SVG color */
}
#ruler-icon.active {
  background-color: #0085ff !important;
}

.icon-container .tooltip {
  visibility: hidden;
  width: 150px;
  padding: 5px;
  font-size: 12px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  position: absolute;
  left: 110%;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip-wrapper {
  padding: 6px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 48px;
}

.tooltip-wrapper::after {
  content: "";
  position: absolute;
  top: -28px;
  left: calc(50% - 9px);
  width: 18px;
  height: 10px;
  background-color: #373737;
  z-index: -10;
  transition: opacity 0.3s;
  visibility: hidden;
  opacity: 0;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.tooltip-wrapper .tooltip {
  background-color: #373737;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  padding: 5px;
  font-size: 12px;
  font-weight: 400 !important;
  line-height: 1.5;
  letter-spacing: 0px;
  width: 248px;
  text-align: left;
  height: 48px;
  position: absolute;
  left: calc(50% - 124px);
  padding-left: 6px;
  transition: opacity 0.3s;
  visibility: hidden;
  opacity: 0;
}
.tooltip-wrapper .tooltip span {
  position: relative;
  top: 1.25px;
}
.measurement-tips-container {
  overflow: hidden;
  height: 20px;
}

.measurement-tips-container:hover {
  overflow: visible;
  height: auto;
}

.measurement-tips-container:hover .tooltip-wrapper::after,
.measurement-tips-container:hover .tooltip {
  transition: opacity 0.3s;
  visibility: visible;
  opacity: 1;
}
.icon-container:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* Measurement Menu */
.measurement-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 0; /* Hidden by default */
  height: 100vh;
  background: #f9f9f9;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 999999999;
  transition: width 0.3s ease;
}
.measurement-menu.visible {
  border-left: 1px solid #ccc;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  padding-bottom: 0px;
  font-size: 18px;
  color: #000;
  font-weight: 600;
}

#resize-handle {
  width: 10px;
  height: 100%;
  cursor: ew-resize;
  background-color: rgba(0, 0, 0, 0.1);
  position: absolute;
  left: -10px;
  top: 0;
}

.measure-tools {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  transition: opacity 0.3s ease;
  z-index: 99999;
  position: relative;
}

.measurement-menu.shrunk .measure-tools {
  opacity: 0;
  pointer-events: none;
}

.measurement-menu.shrunk {
  width: 100px;
}

#shrink-button {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: transform 0.3s ease;
}

#shrink-button.hidden {
  display: none;
}

.tool {
  width: 100%;
  height: 48px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  border: 1px solid #e1e2e6;
  border-radius: 5px;
  cursor: pointer;
  gap: 9px;
  background-color: #fff;
}

.select-wrapper {
  display: flex;
  gap: 16px;
  position: absolute;
  bottom: 48px;
  left: calc(50% - 140px);
}

@media (max-width: 820px) {
  .select-wrapper {
    left: calc(50% - 20px);
  }
}

.select-tool {
  width: 40px;
  height: 40px;
  background-color: #fff;
  padding: 8px;
  border: solid 1px #e1e2e6;
  border-radius: 5px;
  display: none;
  box-shadow:
    0px 1px 3px 0px rgba(0, 0, 0, 0.3),
    0px 4px 8px 3px rgba(0, 0, 0, 0.15);
}

#select-tool-icon {
  position: relative;
  top: 0px;
  width: 20px;
  height: 20px;
  user-select: none;
}

.select-tool.active #select-tool-icon {
  content: url("../assets/whiteCursor.png");
}
.select-tool.active {
  border: solid 1px #0085ff !important;
  background-color: #0085ff !important;
}
/* .select-tool:hover {
  background-color: #fff !important;
  display: none;
} */

.delete-tool {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  background-color: #ffffff;
  display: none;
  border: 1px solid #e1e2e6;
  justify-content: center;
  align-items: center;
  position: static;
  pointer-events: auto;
  box-shadow:
    0px 1px 3px 0px rgba(0, 0, 0, 0.3),
    0px 4px 8px 3px rgba(0, 0, 0, 0.15);
}

#delete-tool-icon {
  width: 20px;
  height: 20px;
  position: relative;
}

.delete-icon-wrapper {
  width: 16px;
  height: 16px;
  display: flex;
}

.measurement-tips {
  height: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.measurement-tips-title {
  color: #0085ff;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0;
  line-height: 100%;
  user-select: none;
}
.measurement-tip-info {
  display: flex;
  align-items: center;
}

.tool:hover {
  background-color: #e4ecf5;
}

.tool.active {
  border: 1px solid #010623;
}

.line {
  padding: 24px;
  border: none;
  border-top: 0.5px solid #e1e2e6;
  width: 85%;
  margin: 0 auto;
}

#close-menu {
  background-color: transparent;
  border: none;
}

.tool span {
  font-size: 12px;
  color: #010623;
  margin-top: 5px;
}

/* Menu Title */
#menu-title {
  display: block;
  font-size: 18px;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.measurement-menu.shrunk #menu-title,
.measurement-menu[style*="width:"] #menu-title {
  display: none;
}

.measurement-menu[style*="width:150px"] #menu-title,
.measurement-menu:not([style*="width"]) #menu-title {
  display: block;
}

/* Measurement Results */
#measurement-results {
  padding: 0 24px;
}

#measurement-results h4 {
  font-size: 1.2em;
  margin-bottom: 10px;
}

#results-list {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: scroll;
}

#results-list li {
  font-size: 12px;
  height: 48px;
  background-color: #f8f8f8;
  color: #676a7b;
}

/* Zoom Circle */
#zoom-circle {
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: block;
  visibility: visible;
}

/* Touch event support for measurement tools */
.viewer-container canvas,
#viewer canvas {
  touch-action: none; /* Prevent default touch behaviors like zooming/panning */
  -webkit-touch-callout: none; /* Disable callout on long press */
  -webkit-user-select: none; /* Disable text selection */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
  user-select: none;
}

/* Loading Overlay & Spinner */
#measurement-overlay,
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#measurement-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.loader-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: #fff;
  margin-left: 22px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Measurement Note */
.measurement-note-container {
  width: 85%;
  margin: 0 auto;
  text-align: left;
  line-height: 18px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.measurement-note {
  font-size: 12px;
}

/* Mobile Popup */
.mobile-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  text-align: center;
  width: 80%;
  max-width: 300px;
  z-index: 10000000;
}

.mobile-popup-content p {
  font-size: 16px;
  color: #333;
}

.mobile-popup-content button {
  margin-top: 10px;
  padding: 10px 15px;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.mobile-popup-content button:hover {
  background-color: #0056b3;
}
