.region-switcher {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.region-switcher-label {
  color: white;
  font-size: 13px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.region-select {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 110px;
  flex-shrink: 0;
}

.region-select:hover {
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.region-select:focus {
  outline: none;
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Ensure sidebar has relative positioning for absolute positioning of switcher */
#sidebar {
  position: relative;
}

/* Tab Interface Styling */
.workflow-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tab-buttons {
  display: flex;
  background: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
  margin: 0;
  padding: 0;
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  text-align: center;
}

.tab-btn:hover {
  background: #e9ecef;
  color: #495057;
}

.tab-btn.active {
  background: white;
  color: #007bff;
  border-bottom-color: #007bff;
  font-weight: 600;
}

.tab-content {
  flex: 1;
  padding: 16px;
  padding-bottom: 16px;
  background: white;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.tab-section {
  margin-bottom: 24px;
}

.tab-section:last-child {
  margin-bottom: 0;
}

.section-header {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e9ecef;
}

.section-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Nested accordion styling for offset tools */
.nested-accordion {
  margin-top: 12px;
}

.nested-accordion summary {
  font-weight: 500;
  font-size: 13px;
  color: #6c757d;
  cursor: pointer;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f4;
}

.nested-accordion[open] summary {
  margin-bottom: 8px;
}

.nested-content {
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Settings button styles */
.settings-btn, .profile-action-btn {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  color: #495057;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
}

.settings-btn:hover, .profile-action-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
}

.settings-btn:active, .profile-action-btn:active {
  background: #dee2e6;
  transform: translateY(1px);
}

/* Disclaimer popup styles */
.disclaimer-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 10003 !important;
  pointer-events: auto !important;
}

.disclaimer-popup .popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

.disclaimer-popup .popup-content {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: white !important;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  width: 680px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 10004 !important;
  display: block !important;
  visibility: visible !important;
}

.disclaimer-popup .popup-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 24px 20px;
  border-bottom: 2px solid #e5e7eb;
  background: linear-gradient(to bottom, #f9fafb, white);
}

.disclaimer-popup .popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

.disclaimer-popup .popup-body {
  padding: 28px;
}

/* Drainage defaults popup styles */
.drainage-defaults-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 10001 !important;
  pointer-events: auto !important;
}

.drainage-defaults-popup .popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.drainage-defaults-popup .popup-content {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: white !important;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 10002 !important;
  display: block !important;
  visibility: visible !important;
}

.drainage-defaults-popup .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.drainage-defaults-popup .popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.drainage-defaults-popup .popup-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.drainage-defaults-popup .popup-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.drainage-defaults-popup .popup-body {
  padding: 24px;
}

.defaults-section {
  margin-bottom: 32px;
}

.defaults-section:last-of-type {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.section-header i {
  font-size: 16px;
  color: #6b7280;
}

.section-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.defaults-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.default-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.default-field label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.default-field input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.default-field input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.popup-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  gap: 12px;
}

.btn-primary, .btn-secondary {
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

/* Spinner animation for elevation loading */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Confirmation Modal */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confirm-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 90%;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.confirm-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
}

.confirm-modal-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.confirm-modal-icon.warning {
  color: #f59e0b;
}

.confirm-modal-icon.danger {
  color: #ef4444;
}

.confirm-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.confirm-modal-body {
  padding: 24px;
}

.confirm-modal-message {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.confirm-modal-warning {
  font-size: 13px;
  color: #dc2626;
  font-weight: 500;
  margin: 12px 0 0 0;
  padding: 12px;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  border-radius: 4px;
}

.confirm-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-modal-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.confirm-modal-btn-cancel:hover {
  background: #e5e7eb;
}

.confirm-modal-btn-confirm {
  background: #ef4444;
  color: white;
}

.confirm-modal-btn-confirm:hover {
  background: #dc2626;
}

.confirm-modal-btn-confirm:active {
  transform: scale(0.98);
}

/* Cesium 3D Viewer Modal */
.cesium-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.cesium-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 90%;
  height: 85%;
  max-width: 1400px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease-out;
}

.cesium-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 12px 0 0;
}

.cesium-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cesium-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.cesium-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.cesium-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

.cesium-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 1000;
}

.cesium-loading i {
  font-size: 48px;
  margin-bottom: 16px;
}

.cesium-loading p {
  font-size: 16px;
  margin: 0;
}

.cesium-controls {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.cesium-control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cesium-control-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.cesium-control-group i {
  color: #6b7280;
}

.cesium-control-group input[type="range"] {
  width: 150px;
  cursor: pointer;
}

.cesium-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.cesium-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.cesium-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.cesium-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.cesium-btn:active {
  transform: translateY(0);
}

/* Camera Control Help */
.cesium-camera-help {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  padding: 16px 20px;
  border-radius: 12px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  min-width: 200px;
}

.cesium-help-title {
  color: white;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 8px;
}

.cesium-help-item {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.cesium-help-item strong {
  color: white;
  font-weight: 600;
  display: inline-block;
  min-width: 120px;
}

.cesium-help-item:last-child {
  margin-bottom: 0;
}

/* 3D Compass Indicator */
.cesium-compass-container {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  pointer-events: none;
  perspective: 400px;
  perspective-origin: 50% 50%;
}

.cesium-compass-3d {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* Floating 3D View Button */
.floating-3d-button {
  position: absolute;
  bottom: 30px;
  right: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 1000;
  transition: all 0.3s ease;
  animation: slideInFromRight 0.5s ease-out;
}

.floating-3d-button .beta-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.3);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: -2px;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.floating-3d-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.floating-3d-button:active {
  transform: translateY(-1px);
}

.floating-3d-button i {
  font-size: 16px;
}

/* Field Name Popup for Ditch Assist Export */
.field-name-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 10005 !important;
  pointer-events: auto !important;
}

.field-name-popup .popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.field-name-popup .popup-content {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: white !important;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  width: 450px;
  max-width: 90vw;
  z-index: 10006 !important;
  display: block !important;
  visibility: visible !important;
}

.field-name-popup .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(to bottom, #f9fafb, white);
}

.field-name-popup .popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.field-name-popup .popup-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.field-name-popup .popup-close-btn:hover {
  background: #f3f4f6;
  color: #4b5563;
}

.field-name-popup .popup-body {
  padding: 24px;
}

.field-name-popup .popup-description {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
}

.field-name-popup .field-name-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  color: #1f2937;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.field-name-popup .field-name-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.field-name-popup .popup-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.4;
}

.field-name-popup .popup-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.field-name-popup .popup-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.field-name-popup .popup-btn-cancel {
  background: white;
  border: 1px solid #d1d5db;
  color: #4b5563;
}

.field-name-popup .popup-btn-cancel:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

.field-name-popup .popup-btn-primary {
  background: #3b82f6;
  color: white;
}

.field-name-popup .popup-btn-primary:hover {
  background: #2563eb;
}

.field-name-popup .popup-btn-primary:active {
  background: #1d4ed8;
}

