/*!
 * MIGIS SDK Stylesheet
 * Required for SDK controls, widgets, and overlays.
 * Include via: <link rel="stylesheet" href="https://sdk.migis.mapplsgov.com/dist/migis-sdk.css" />
 *         or: import '@migis/sdk/dist/migis-sdk.css';
 */

/* ===== Map Container ===== */
.migis-map,
.migis-scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a1a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #f5f5f5;
}

.migis-map canvas,
.migis-scene canvas {
  outline: none;
  display: block;
}

/* ===== Generic Control Surface ===== */
.migis-control {
  position: absolute;
  z-index: 10;
  background: rgba(28, 28, 32, 0.92);
  color: #f5f5f5;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  user-select: none;
  pointer-events: auto;
}

.migis-control button {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 4px 8px;
  font: inherit;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.migis-control button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.migis-control button:active {
  background: rgba(255, 255, 255, 0.18);
}

.migis-control button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Zoom Control ===== */
.migis-zoom-control {
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
}

.migis-zoom-control button {
  width: 30px;
  height: 30px;
  border-radius: 0;
  border: none;
  background: rgba(28, 28, 32, 0.92);
  color: #f5f5f5;
  font-size: 16px;
  font-weight: 600;
}

.migis-zoom-control button:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.migis-zoom-control button:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* ===== Scale Bar ===== */
.migis-scalebar {
  bottom: 12px;
  left: 12px;
  background: rgba(28, 28, 32, 0.85);
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.migis-scalebar-line {
  display: block;
  border-bottom: 2px solid #f5f5f5;
  margin-top: 2px;
  height: 4px;
}

/* ===== Layer Switcher ===== */
.migis-layer-switcher {
  top: 12px;
  left: 12px;
  min-width: 200px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px 12px;
}

.migis-layer-switcher h4 {
  margin: 0 0 6px 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.migis-layer-switcher ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.migis-layer-switcher li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.migis-layer-switcher input[type="checkbox"] {
  cursor: pointer;
}

/* ===== Attribution ===== */
.migis-attribution {
  bottom: 0;
  right: 0;
  border-radius: 4px 0 0 0;
  padding: 2px 6px;
  font-size: 10px;
  background: rgba(28, 28, 32, 0.75);
}

.migis-attribution a {
  color: #88c5ff;
  text-decoration: none;
}

.migis-attribution a:hover {
  text-decoration: underline;
}

/* ===== Time Slider ===== */
.migis-timeslider {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.migis-timeslider input[type="range"] {
  flex: 1;
  cursor: pointer;
}

.migis-timeslider .migis-time-label {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  opacity: 0.85;
}

/* ===== Popup ===== */
.migis-popup {
  position: absolute;
  background: #1f1f24;
  color: #f5f5f5;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  max-width: 320px;
  z-index: 50;
  pointer-events: auto;
}

.migis-popup-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
}

.migis-popup-close:hover {
  opacity: 1;
}

/* ===== Tooltip ===== */
.migis-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 60;
}

/* ===== Drawing Status Bar ===== */
.migis-draw-status {
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(40, 80, 200, 0.92);
  border-color: rgba(255, 255, 255, 0.18);
}

.migis-draw-status button {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ===== Loading Overlay ===== */
.migis-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #f5f5f5;
  font-size: 13px;
  pointer-events: none;
  z-index: 100;
}

.migis-loading::before {
  content: "";
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #f5f5f5;
  border-radius: 50%;
  animation: migis-spin 0.8s linear infinite;
}

@keyframes migis-spin {
  to { transform: rotate(360deg); }
}

/* ===== Light theme override ===== */
.migis-theme-light .migis-control,
.migis-theme-light .migis-popup,
.migis-theme-light .migis-attribution,
.migis-theme-light .migis-scalebar {
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a;
  border-color: rgba(0, 0, 0, 0.1);
}

.migis-theme-light .migis-control button {
  background: rgba(0, 0, 0, 0.04);
  color: #1a1a1a;
  border-color: rgba(0, 0, 0, 0.1);
}

.migis-theme-light .migis-control button:hover {
  background: rgba(0, 0, 0, 0.08);
}
