* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: Optima, 'Palatino Linotype', Palatino, Georgia, serif;
  background: #FEFAF6;
}

#app {
  display: flex;
  height: 100%;
}

/* ---- Left Panel ---- */

#panel {
  width: 300px;
  min-width: 300px;
  background: #FEFAF6;
  color: #3a3630;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 2;
  border-right: 1px solid #e0d8ce;
}

#panel h1 {
  font-size: 16px;
  padding: 14px 16px 10px;
  letter-spacing: .5px;
  color: #2a2520;
  font-weight: 700;
}

.section {
  padding: 10px 16px;
  border-top: 1px solid #e8e0d6;
}

.section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #9a8e80;
  margin-bottom: 8px;
  font-weight: 600;
}

/* Basemap / projection buttons */

.basemap-btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #f0ebe4;
  color: #5a5248;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  transition: .15s;
}

.basemap-btn:hover {
  background: #e8e0d6;
}

.basemap-btn.active {
  border-color: #8a6d4b;
  color: #2a2520;
  background: #ede4d8;
  font-weight: 600;
}

/* Layer toggles */

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.layer-row input[type=checkbox] {
  accent-color: #8a6d4b;
}

.layer-row label {
  font-size: 13px;
  cursor: pointer;
  flex: 1;
}

.layer-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.layer-delete {
  background: none;
  border: none;
  color: #c0765a;
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  flex-shrink: 0;
}

.layer-delete:hover {
  color: #a0503a;
}

/* Georef section */

#georef-section .section-title {
  margin-bottom: 6px;
}

#drop-zone {
  border: 2px dashed #c8bfb2;
  border-radius: 8px;
  padding: 24px 12px;
  text-align: center;
  color: #9a8e80;
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
}

#drop-zone.drag-over {
  border-color: #8a6d4b;
  color: #6a5840;
  background: rgba(138, 109, 75, .06);
}

#drop-zone.has-image {
  border-style: solid;
  border-color: #c8bfb2;
  padding: 8px;
}

#drop-zone img {
  max-width: 100%;
  border-radius: 4px;
}

.gcp-list {
  margin-top: 8px;
}

.gcp-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 0;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  color: #5a5248;
}

.gcp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gcp-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: #c0765a;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

.gcp-remove:hover {
  color: #a0503a;
}

.georef-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: .15s;
}

.btn-primary {
  background: #8a6d4b;
  color: #FEFAF6;
}

.btn-primary:hover {
  background: #755a3c;
}

.btn-primary:disabled {
  opacity: .4;
  cursor: default;
}

.btn-danger {
  background: #b05040;
  color: #FEFAF6;
}

.btn-danger:hover {
  background: #943828;
}

.btn-secondary {
  background: #e8e0d6;
  color: #5a5248;
}

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

#warp-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 280px;
  background: rgba(254, 250, 246, .95);
  border: 1px solid #d8d0c6;
  border-radius: 10px;
  padding: 18px 20px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
  text-align: center;
}

#warp-progress .progress-track {
  height: 8px;
  background: #e8e0d6;
  border-radius: 4px;
  overflow: hidden;
}

#warp-progress .progress-fill {
  height: 100%;
  width: 0%;
  background: #8a6d4b;
  border-radius: 4px;
  transition: width 0.1s linear;
}

.progress-label {
  margin-top: 8px;
  font-size: 13px;
  color: #5a5248;
  font-weight: 600;
}

.status {
  font-size: 11px;
  color: #9a8e80;
  margin-top: 8px;
  min-height: 16px;
}

/* ---- Map ---- */

#map-wrap {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* GCP crosshair cursor */

#map.gcp-mode {
  cursor: crosshair;
}

/* GCP markers on map */

.gcp-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  pointer-events: none;
}

/* Instructions overlay */

#instructions {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(42, 37, 32, .88);
  color: #FEFAF6;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 5;
  pointer-events: none;
  transition: opacity .3s;
  white-space: nowrap;
}

#instructions.hidden {
  opacity: 0;
}

/* Opacity slider */

.opacity-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.opacity-row input[type=range] {
  flex: 1;
  accent-color: #8a6d4b;
}

.opacity-row span {
  font-size: 11px;
  min-width: 30px;
  text-align: right;
}

/* Search box */

#search-box {
  position: absolute;
  top: 12px;
  right: 54px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d8d0c6;
}

#search-input {
  width: 260px;
  padding: 9px 14px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  background: #FEFAF6;
  color: #2a2520;
}

#search-input::placeholder {
  color: #b0a898;
}

#search-btn {
  padding: 9px 14px;
  border: none;
  background: #8a6d4b;
  color: #FEFAF6;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

#search-btn:hover {
  background: #755a3c;
}

#search-results {
  width: 100%;
  background: #FEFAF6;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
  max-height: 240px;
  overflow-y: auto;
  display: none;
}

#search-results.open {
  display: block;
}

.search-result {
  padding: 8px 14px;
  font-size: 13px;
  color: #3a3630;
  cursor: pointer;
  border-top: 1px solid #e8e0d6;
}

.search-result:first-child {
  border-top: none;
}

.search-result:hover {
  background: #f0ebe4;
}

.search-result small {
  color: #9a8e80;
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

/* Search marker */

.search-pin {
  width: 24px;
  height: 24px;
  background: #8a6d4b;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 0 6px rgba(0, 0, 0, .25);
  cursor: pointer;
}

.popup-delete-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  background: #b05040;
  color: #FEFAF6;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.popup-delete-btn:hover {
  background: #943828;
}
