/* ==================== MAP-3D.CSS ==================== */
/* 3D map specific styles including 3D legend symbols, preset views, view controls panel, mini map, and 3D-specific controls */

/* Map Sections */
.map-section {
  height: calc(100vh - 80px);
  position: relative;
  background: var(--navy-darker);
}

.map-container {
  height: 100%;
  width: 100%;
}

.map-toolbar {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
  background: var(--white);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-toolbar button {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--navy);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.map-toolbar button:hover {
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: var(--white);
  transform: scale(1.05);
}

.map-toolbar .divider {
  height: 1px;
  background: var(--gray-100);
  margin: 4px 0;
}

/* Hide zoom controls in 3D map */
#zoomIn3d,
#zoomOut3d {
  display: none !important;
}

/* 3D Legend Symbols */
.legend-symbol-3d {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  position: relative;
}

.legend-symbol-3d.well-tower {
  background: linear-gradient(180deg, var(--gold) 60%, #666 100%);
  border-radius: 2px;
  width: 8px;
  height: 18px;
  margin-left: 5px;
}

.legend-symbol-3d.well-tower::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -4px;
  width: 16px;
  height: 4px;
  background: #666;
  border-radius: 2px;
}

.legend-symbol-3d.facility-3d {
  background: linear-gradient(135deg, var(--red), #a33);
  border-radius: 3px;
}

.legend-symbol-3d.tank-3d {
  background: linear-gradient(180deg, #999, #666);
  border-radius: 50%;
}

.legend-area.terrain {
  background: linear-gradient(180deg, #c9a96e, #8b7355);
  border: none;
}

/* Preset Views */
.preset-views {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
}

.preset-views h5 {
  font-size: 0.85rem;
  color: var(--navy);
  margin-bottom: 12px;
  font-weight: 600;
}

.preset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:last-child {
  margin-bottom: 0;
}

.preset-btn:hover {
  background: var(--off-white);
  border-color: var(--cyan);
}

.preset-btn i {
  color: var(--cyan);
}

/* View Controls Panel */
.view-controls-panel {
  position: absolute;
  top: 80px;
  left: 80px;
  z-index: 150;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 260px;
  display: none;
}

.view-controls-panel.active {
  display: block;
}

.view-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.view-control-header h4 {
  font-size: 0.95rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-control-header h4 i {
  color: var(--cyan);
}

.view-control-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

.view-control-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.view-control-item:last-child {
  border-bottom: none;
}

.view-control-item label:first-child {
  font-size: 0.85rem;
  color: var(--navy);
}

.view-control-item input[type="range"] {
  width: 100px;
  margin: 0 10px;
}

.view-control-item span {
  font-size: 0.8rem;
  color: var(--cyan);
  min-width: 40px;
  text-align: right;
}

/* Mini Map */
.mini-map {
  position: absolute;
  bottom: 30px;
  right: 20px;
  z-index: 100;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 200px;
}

.mini-map.minimized #miniMapView {
  display: none;
}

.mini-map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.75rem;
}

.mini-map-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
}

.mini-map-header button:hover {
  color: var(--white);
}

#miniMapView {
  height: 150px;
}

/* Search Panel */
.search-panel {
  position: absolute;
  top: 20px;
  left: 80px;
  z-index: 150;
  background: var(--white);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow-lg);
  width: 320px;
  display: none;
  overflow: hidden;
}

.search-panel.active {
  display: block;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  gap: 10px;
  cursor: grab;
}

.search-input-wrapper:active {
  cursor: grabbing;
}

.search-input-wrapper i.fa-search {
  color: var(--text-secondary);
}

.search-input-wrapper input {
  flex: 1;
  border: none;
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
}

.search-input-wrapper button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

.search-input-wrapper button:hover {
  color: var(--red);
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid var(--gray-100);
}

.search-result-item:hover {
  background: var(--off-white);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item i {
  color: var(--gold);
  font-size: 1.1rem;
}

.search-result-item div {
  flex: 1;
}

.search-result-item strong {
  display: block;
  color: var(--navy);
  font-size: 0.9rem;
}

.search-result-item span {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Layer Panel */
.layer-panel, .layer-panel-3d {
  position: absolute;
  top: 80px;
  right: 20px;
  z-index: 150;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 280px;
  display: none;
  overflow: hidden;
}

.layer-panel.active, .layer-panel-3d.active {
  display: block;
  animation: slideIn 0.3s ease;
}

.layer-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(180deg, var(--white), var(--off-white));
}

.layer-panel-header h4 {
  font-family: 'Cairo', sans-serif;
  color: var(--navy);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.layer-panel-header h4 i {
  color: var(--cyan);
}

.layer-panel-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

.layer-panel-header button:hover {
  color: var(--red);
}

.layer-list {
  padding: 16px 20px;
}

.layer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.layer-item:last-child {
  border-bottom: none;
}

.layer-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.layer-checkbox input {
  display: none;
}

.layer-checkbox .checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--gray-200);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.layer-checkbox input:checked + .checkmark {
  background: var(--cyan);
  border-color: var(--cyan);
}

.layer-checkbox input:checked + .checkmark::after {
  content: '✓';
  color: var(--white);
  font-size: 0.7rem;
  font-weight: bold;
}

.layer-name {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
}

.layer-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--off-white);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Map Info Panel */
.map-info-panel {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 100;
  background: var(--white);
  border-radius: 10px;
  padding: 10px 12px;
  padding-top: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-info-panel.draggable-panel::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  cursor: grab;
}

.map-info-panel.draggable-panel:active::before {
  cursor: grabbing;
}

.map-info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--gray-100);
}

.map-info-item:last-child {
  border-right: none;
  padding-right: 0;
}

.map-info-item:first-child {
  padding-left: 0;
}

.map-info-item span {
  font-size: 0.65rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.map-info-item strong {
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  color: var(--navy);
}

/* Feature Panel */
.feature-panel {
  position: absolute;
  bottom: 30px;
  right: 20px;
  z-index: 100;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 300px;
  display: none;
}

.feature-panel.active {
  display: block;
}

.feature-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  background: linear-gradient(180deg, var(--navy), var(--navy-light));
  color: var(--white);
  border-radius: 12px 12px 0 0;
}

.feature-panel-header h4 {
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
}

.feature-panel-header button {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
}

.feature-panel-header button:hover {
  color: var(--white);
}

.feature-panel-content {
  padding: 20px;
}

/* Legend Panel */
.map-legend {
  position: absolute;
  bottom: 30px;
  left: 20px;
  z-index: 100;
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
}

.map-legend h4 {
  font-family: 'Cairo', sans-serif;
  color: var(--navy);
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-legend h4 i {
  color: var(--cyan);
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.legend-header h4 {
  margin-bottom: 0;
}

.legend-header button {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--off-white);
  border-radius: 8px;
  cursor: pointer;
  color: var(--navy);
  transition: all 0.2s ease;
}

.legend-header button:hover {
  background: var(--cyan);
  color: var(--white);
}

.legend-panel {
  position: absolute;
  bottom: 30px;
  left: 20px;
  z-index: 100;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 16px 20px;
  min-width: 200px;
}

.legend-panel h4 {
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-panel h4 i {
  color: var(--cyan);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-symbol {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-line {
  width: 30px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-line.pipeline {
  background: var(--green);
}

.legend-area {
  width: 20px;
  height: 14px;
  border: 2px solid var(--purple);
  background: rgba(124, 58, 237, 0.1);
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-area.terrain {
  border-color: var(--purple);
  background: rgba(124, 58, 237, 0.2);
}

.legend-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ArcGIS Widget Overrides */
.esri-ui-corner .esri-component {
  box-shadow: var(--shadow-md) !important;
  border-radius: 8px !important;
}

.esri-widget--button {
  background: var(--white) !important;
  color: var(--navy) !important;
}

.esri-widget--button:hover {
  background: var(--navy) !important;
  color: var(--gold-light) !important;
}

.esri-popup,
.esri-popup__main-container,
.esri-features,
.esri-widget--panel {
  z-index: 9999 !important;
}

.esri-popup--is-docked {
  z-index: 9999 !important;
}
