/* ============================================================================
   GeoEditor Control Styles
   ============================================================================ */

/* Base control container */
.geo-editor-control {
  background: transparent;
  box-shadow: none;
}

/* Toolbar container */
.geo-editor-toolbar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Collapsed toolbar - minimal padding and no gap */
.geo-editor-toolbar--collapsed {
  padding: 0;
  gap: 0;
}

.geo-editor-toolbar--vertical {
  flex-direction: column;
}

.geo-editor-toolbar--horizontal {
  flex-direction: row;
}

/* Tools wrapper (for collapse/expand functionality) */
.geo-editor-tools-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.geo-editor-toolbar--horizontal .geo-editor-tools-wrapper {
  flex-direction: row;
}

/* Collapse button */
.geo-editor-collapse-btn {
  margin-bottom: 4px;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
}

.geo-editor-toolbar--horizontal .geo-editor-collapse-btn {
  margin-bottom: 0;
  margin-right: 4px;
}

/* No margin when collapsed */
.geo-editor-toolbar--collapsed .geo-editor-collapse-btn {
  margin: 0;
}

/* Tool group */
.geo-editor-tool-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.geo-editor-toolbar--horizontal .geo-editor-tool-group {
  flex-direction: row;
}

.geo-editor-tool-group:not(:last-child) {
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e5e5;
}

.geo-editor-toolbar--horizontal .geo-editor-tool-group:not(:last-child) {
  padding-bottom: 0;
  padding-right: 4px;
  border-bottom: none;
  border-right: 1px solid #e5e5e5;
}

.geo-editor-tool-group-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  padding: 2px 4px;
  letter-spacing: 0.5px;
}

.geo-editor-tool-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.geo-editor-toolbar--horizontal .geo-editor-tool-buttons {
  flex-direction: row;
}

/* Multi-column layout for button groups (vertical orientation only) */
.geo-editor-toolbar--vertical.geo-editor-toolbar--columns-2 .geo-editor-tool-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.geo-editor-toolbar--vertical.geo-editor-toolbar--columns-3 .geo-editor-tool-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

.geo-editor-toolbar--vertical.geo-editor-toolbar--columns-4 .geo-editor-tool-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}

/* Tool button */
.geo-editor-tool-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  transition: all 0.15s ease;
}

.geo-editor-tool-button:hover {
  background: #e8e8e8;
}

.geo-editor-tool-button:active {
  background: #ddd;
}

.geo-editor-tool-button--active,
.geo-editor-tool-button.geo-editor-tool-button--active {
  background: #3388ff !important;
  background-color: #3388ff !important;
  color: #fff !important;
}

.geo-editor-tool-button--active:hover,
.geo-editor-tool-button.geo-editor-tool-button--active:hover {
  background: #2277ee !important;
  background-color: #2277ee !important;
}

.geo-editor-tool-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* History button disabled states */
.geo-editor-tool-button[data-history]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.geo-editor-tool-button[data-history]:disabled:hover {
  background: #f5f5f5;
}

.geo-editor-tool-button svg {
  width: 18px;
  height: 18px;
}

/* Active button icons - force white color with high specificity */
.geo-editor-tool-button--active svg {
  color: #fff !important;
}

.geo-editor-tool-button--active svg path,
.geo-editor-tool-button--active svg polygon,
.geo-editor-tool-button--active svg rect,
.geo-editor-tool-button--active svg circle,
.geo-editor-tool-button--active svg ellipse,
.geo-editor-tool-button--active svg line,
.geo-editor-tool-button--active svg text {
  fill: #fff !important;
  color: #fff !important;
}

/* For stroke-only elements - stroke white, preserve fill:none */
.geo-editor-tool-button--active svg path[fill="none"],
.geo-editor-tool-button--active svg polygon[fill="none"],
.geo-editor-tool-button--active svg rect[fill="none"],
.geo-editor-tool-button--active svg circle[fill="none"],
.geo-editor-tool-button--active svg ellipse[fill="none"],
.geo-editor-tool-button--active svg line[fill="none"] {
  fill: none !important;
  stroke: #fff !important;
}

/* Elements with explicit stroke attribute */
.geo-editor-tool-button--active svg [stroke],
.geo-editor-tool-button--active svg path[stroke],
.geo-editor-tool-button--active svg polygon[stroke],
.geo-editor-tool-button--active svg rect[stroke],
.geo-editor-tool-button--active svg circle[stroke],
.geo-editor-tool-button--active svg ellipse[stroke],
.geo-editor-tool-button--active svg line[stroke] {
  stroke: #fff !important;
}

/* Tooltip styling */
.geo-editor-tool-button[title] {
  position: relative;
}

/* ============================================================================
   Dialog Styles
   ============================================================================ */

.geo-editor-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.geo-editor-dialog {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
}

.geo-editor-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e5e5;
}

.geo-editor-dialog-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.geo-editor-dialog-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.15s ease;
}

.geo-editor-dialog-close:hover {
  background: #f5f5f5;
  color: #333;
}

.geo-editor-dialog-body {
  padding: 20px;
}

.geo-editor-dialog-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid #e5e5e5;
}

/* ============================================================================
   Form Controls
   ============================================================================ */

.geo-editor-form-group {
  margin-bottom: 16px;
}

.geo-editor-form-group:last-child {
  margin-bottom: 0;
}

.geo-editor-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.geo-editor-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.geo-editor-input:focus {
  outline: none;
  border-color: #3388ff;
  box-shadow: 0 0 0 3px rgba(51, 136, 255, 0.1);
}

.geo-editor-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e5e5e5;
  appearance: none;
  cursor: pointer;
}

.geo-editor-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3388ff;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.geo-editor-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.geo-editor-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: #3388ff;
  cursor: pointer;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.geo-editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.geo-editor-btn--primary {
  background: #3388ff;
  color: #fff;
}

.geo-editor-btn--primary:hover {
  background: #2277ee;
}

.geo-editor-btn--secondary {
  background: #f5f5f5;
  color: #333;
}

.geo-editor-btn--secondary:hover {
  background: #e8e8e8;
}

.geo-editor-btn--danger {
  background: #dc3545;
  color: #fff;
}

.geo-editor-btn--danger:hover {
  background: #c82333;
}

.geo-editor-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================
   Stats Display
   ============================================================================ */

.geo-editor-stats {
  display: flex;
  gap: 20px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 4px;
  margin-bottom: 16px;
}

.geo-editor-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.geo-editor-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.geo-editor-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
}

.geo-editor-stat--highlight .geo-editor-stat-value {
  color: #3388ff;
}

.geo-editor-stat--success .geo-editor-stat-value {
  color: #28a745;
}

/* ============================================================================
   Messages
   ============================================================================ */

.geo-editor-message {
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 16px;
}

.geo-editor-message--info {
  background: #e7f3ff;
  color: #0056b3;
  border: 1px solid #b8daff;
}

.geo-editor-message--warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.geo-editor-message--error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.geo-editor-message--success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* ============================================================================
   Selection Highlight
   ============================================================================ */

.geo-editor-selection-highlight {
  stroke: #3388ff;
  stroke-width: 3;
  stroke-dasharray: 5, 5;
  fill: rgba(51, 136, 255, 0.1);
  animation: geo-editor-dash 0.5s linear infinite;
}

@keyframes geo-editor-dash {
  to {
    stroke-dashoffset: -10;
  }
}

/* ============================================================================
   Feature Properties Popup
   ============================================================================ */

.geo-editor-properties-popup .maplibregl-popup-content {
  padding: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.geo-editor-popup-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.geo-editor-popup-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #e0e0e0;
}

.geo-editor-popup-table tr:last-child td {
  border-bottom: none;
}

.geo-editor-popup-key {
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  vertical-align: top;
}

.geo-editor-popup-value {
  color: #666;
  word-break: break-word;
}

.geo-editor-popup-empty {
  color: #999;
  font-style: italic;
  padding: 8px;
  text-align: center;
}

/* ============================================================================
   Responsive Adjustments
   ============================================================================ */

@media (max-width: 768px) {
  .geo-editor-toolbar {
    padding: 2px;
  }

  .geo-editor-tool-button {
    width: 36px;
    height: 36px;
  }

  .geo-editor-dialog {
    max-width: 95%;
    margin: 10px;
  }
}

/* ============================================================================
   Attribute Editing Panel
   ============================================================================ */

.geo-editor-attribute-panel {
  position: absolute;
  top: 10px;
  width: 300px;
  max-height: 80vh;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
  overflow: hidden;
}

.geo-editor-attribute-panel--right {
  right: 10px;
}

.geo-editor-attribute-panel--left {
  left: 10px;
}

/* Position offsets are applied via inline styles for customization */

.geo-editor-attribute-panel--hidden {
  opacity: 0;
  pointer-events: none;
}

.geo-editor-attribute-panel--right.geo-editor-attribute-panel--hidden {
  transform: translateX(100%);
}

.geo-editor-attribute-panel--left.geo-editor-attribute-panel--hidden {
  transform: translateX(-100%);
}

/* Panel Header */
.geo-editor-attribute-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: #f8f9fa;
  flex-shrink: 0;
}

.geo-editor-attribute-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.geo-editor-attribute-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.15s ease;
}

.geo-editor-attribute-panel-close:hover {
  background: #e8e8e8;
  color: #333;
}

/* Panel Body */
.geo-editor-attribute-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Panel Footer */
.geo-editor-attribute-panel-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid #e5e5e5;
  background: #f8f9fa;
  flex-shrink: 0;
}

/* Attribute Form Groups */
.geo-editor-attribute-form-group {
  margin-bottom: 16px;
}

.geo-editor-attribute-form-group:last-child {
  margin-bottom: 0;
}

.geo-editor-attribute-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  margin-bottom: 6px;
}

.geo-editor-attribute-label--required::after {
  content: ' *';
  color: #dc3545;
}

/* Attribute Input Controls */
.geo-editor-attribute-input,
.geo-editor-attribute-select,
.geo-editor-attribute-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.geo-editor-attribute-input:focus,
.geo-editor-attribute-select:focus,
.geo-editor-attribute-textarea:focus {
  outline: none;
  border-color: #3388ff;
  box-shadow: 0 0 0 3px rgba(51, 136, 255, 0.1);
}

.geo-editor-attribute-input:disabled,
.geo-editor-attribute-select:disabled,
.geo-editor-attribute-textarea:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
  color: #666;
}

.geo-editor-attribute-textarea {
  min-height: 80px;
  resize: vertical;
}

.geo-editor-attribute-input[type="color"] {
  padding: 4px;
  height: 40px;
  cursor: pointer;
}

.geo-editor-attribute-input[type="date"] {
  cursor: pointer;
}

/* Checkbox styling */
.geo-editor-attribute-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.geo-editor-attribute-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #3388ff;
}

.geo-editor-attribute-checkbox-label {
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

/* Read-only field styling */
.geo-editor-attribute-readonly {
  background-color: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 14px;
  color: #666;
  word-break: break-word;
}

.geo-editor-attribute-readonly-null {
  color: #999;
  font-style: italic;
}

/* Extra properties section */
.geo-editor-attribute-extra-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed #ddd;
}

.geo-editor-attribute-extra-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #666;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Validation error */
.geo-editor-attribute-error {
  font-size: 12px;
  color: #dc3545;
  margin-top: 4px;
}

.geo-editor-attribute-input--error,
.geo-editor-attribute-select--error,
.geo-editor-attribute-textarea--error {
  border-color: #dc3545;
}

.geo-editor-attribute-input--error:focus,
.geo-editor-attribute-select--error:focus,
.geo-editor-attribute-textarea--error:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Empty state */
.geo-editor-attribute-empty {
  text-align: center;
  padding: 32px 16px;
  color: #666;
  font-size: 14px;
}

/* Geometry type badge */
.geo-editor-attribute-geometry-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  background: #e7f3ff;
  color: #0056b3;
}

/* Responsive adjustments for attribute panel */
@media (max-width: 768px) {
  .geo-editor-attribute-panel {
    width: calc(100% - 20px);
    max-width: 320px;
  }
}

/* ============================================================================
   Geoman Vertex Marker Transparency
   ============================================================================ */

/* Make Geoman's vertex marker fills semi-transparent while keeping outlines opaque */
.marker-wrapper svg circle {
  fill-opacity: 0.5 !important;
}

.marker-wrapper svg path {
  fill-opacity: 0.5 !important;
}

