/* Zone editor side panel — slide-in panel for creating/editing map zones.
   Mirrors the .map-layers-panel pattern so map controls feel cohesive. */

.map-container .zone-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  z-index: 199;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.map-container .zone-panel.gone {
  transform: translateX(100%);
}

@media (max-width: 992px) {
  .map-container .zone-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 50vh;
    height: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(0);
    z-index: 1000006;
  }
  .map-container .zone-panel.gone {
    transform: translateY(calc(100% + 24px));
  }
  .zone-panel-header {
    position: relative;
    padding: 14px 10px 8px 20px;
  }
  /* Drag-handle affordance so it reads as a bottom sheet */
  .zone-panel-header::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d6dde1;
  }
  .zone-panel-body {
    padding: 12px 16px 8px;
  }
  .zone-form { gap: 14px; }

  /* Compact horizontal type picker — chips instead of cards */
  .zone-type-picker {
    flex-direction: row;
    gap: 6px;
  }
  .zone-type-option {
    flex: 1;
    min-width: 0;
    grid-template-columns: 4px 1fr;
    gap: 8px;
    padding: 8px 10px 8px 0;
  }
  .zone-type-desc,
  .zone-type-check {
    display: none;
  }
  .zone-type-name {
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .zone-help { margin-top: 8px; padding-top: 4px; }
  .zone-help-summary { padding: 6px 4px; }
  .zone-panel-footer { padding: 10px 16px 14px; }
}

.zone-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px 24px;
  border-bottom: 1px solid var(--border-light);
}

.zone-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.2px;
}

.zone-panel-close {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: background-color 0.15s ease;
}

.zone-panel-close:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.zone-panel-close .icon {
  width: 22px;
  height: 22px;
}

.zone-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 12px;
}

.zone-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.zone-form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-label);
  margin: 0 0 4px;
}

.zone-type-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zone-type-option {
  --zone-color: var(--text-muted);
  position: relative;
  display: grid;
  grid-template-columns: 6px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px 12px 0;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.zone-type-option:hover {
  background: var(--bg-hover);
  border-color: #cfd8dc;
}

.zone-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.zone-type-ribbon {
  width: 6px;
  height: 100%;
  background: var(--zone-color);
  align-self: stretch;
}

.zone-type-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.zone-type-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.zone-type-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.zone-type-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #cfd8dc;
  flex-shrink: 0;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.zone-type-option:has(input:checked) {
  border-color: var(--zone-color);
  background: color-mix(in srgb, var(--zone-color) 6%, white);
  box-shadow: 0 0 0 1px var(--zone-color) inset;
}

.zone-type-option:has(input:checked) .zone-type-check {
  border-color: var(--zone-color);
  background: var(--zone-color);
}

.zone-type-option:has(input:checked) .zone-type-check::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.zone-type-option input:focus-visible ~ .zone-type-ribbon {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.zone-type-nogo { --zone-color: #E70000; }
.zone-type-go   { --zone-color: #00B400; }
.zone-type-home { --zone-color: #0000E7; }

.zone-name-input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid #d6dde1;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: 'Roboto', sans-serif;
}

.zone-name-input::placeholder { color: var(--text-muted); }
.zone-name-input:hover { border-color: #b9c3c9; }

.zone-name-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 160, 155, 0.15);
}

.zone-help {
  margin-top: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.zone-help-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  cursor: pointer;
  list-style: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.zone-help-summary::-webkit-details-marker { display: none; }

.zone-help-icon {
  width: 18px;
  height: 18px;
  color: var(--teal);
  flex-shrink: 0;
}

.zone-help-label { flex: 1; }

.zone-help-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.zone-help[open] .zone-help-chevron { transform: rotate(90deg); }

.zone-help-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 4px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.zone-help-step h5 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-label);
  margin: 0 0 6px;
}

.zone-help-step p { margin: 0; }

.zone-help-step ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zone-help-step ol li::marker {
  color: var(--teal);
  font-weight: 700;
}

.zone-panel-footer {
  display: flex;
  gap: 10px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border-light);
  background: #fff;
}

.zone-action {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.zone-action .icon { width: 18px; height: 18px; }
.zone-action:active { transform: translateY(1px); }

.zone-action-primary {
  background: var(--blue);
  color: #fff;
}

.zone-action-primary:hover { background: var(--blue-light-hover); }

.zone-action-primary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.zone-action-danger {
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
}

.zone-action-danger:hover { background: var(--red-hover); }

.zone-action-danger:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
