/* Area Menu */
.area-menu {
  position: fixed;
  top: 74px;
  display: none;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1201;
  overflow: hidden;
}

.area-menu.open {
  display: flex;
}

.location-step {
  width: 200px;
  height: 550px;
  flex-direction: column;
  border-right: 1px solid #e5e7eb;
  display: flex;
}

.step-header {
  flex-shrink: 0;
}

.step-actions {
  flex-shrink: 0;
}

.location-step[data-step="region"] .step-options,
.location-step[data-step="areaType"] .step-options,
.location-step[data-step="areas"] .step-areas {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.location-step:last-child {
  border-right: none;
}

/* On desktop, first two steps always visible, third step respects .visible */
@media (min-width: 769px) {
  .location-step[data-step="areas"]:not(.visible) {
    display: none;
  }
}

/* Accordion: only show active step on mobile */
@media (max-width: 768px) {
  .area-menu {
    position: fixed;
    top: 74px;
    left: 16px !important;
    right: 16px;
    width: auto;
    max-width: none;
    flex-direction: column;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-sizing: border-box;
  }

  .location-step {
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 300px;
    max-height: 500px;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    position: absolute;
    left: 0;
    right: 0;
    margin: 0;
    background: white;
    transform: translateX(100%);
    transition: transform 0.2s ease-in-out;
    display: flex;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .location-step:not(.visible) {
    display: none;
  }

  .location-step.visible {
    transform: translateX(0);
  }

  .location-step[data-step="region"].visible {
    position: relative;
  }

  .step-header {
    padding: 12px;
    box-sizing: border-box;
  }

  .location-step[data-step="region"] .step-options,
  .location-step[data-step="areaType"] .step-options,
  .location-step[data-step="areas"] .step-areas {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
  }

  .location-step:last-child {
    border-bottom: none;
  }

  #topnav-area-btn {
    min-width: 120px;
  }
}

/* Base styles for step elements */
.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.step-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}

.step-back,
.step-close {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  font-size: 14px;
  cursor: pointer;
  color: #374151;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  min-width: 28px;
  text-align: center;
}

.step-back {
  display: none;
}

@media (max-width: 768px) {
  .step-back {
    display: block;
  }
}

.step-back:hover,
.step-close:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.step-options {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.step-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.15s;
  text-align: left;
}

.step-option:hover {
  background: #f3f4f6;
}

.step-option.selected {
  background: #3b82f6;
  color: white;
}

.step-option.selected .option-arrow {
  color: white;
}

.option-text {
  flex: 1;
  font-size: 13px;
}

.option-arrow {
  color: #9ca3af;
  font-size: 12px;
}

.step-areas {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.dropdown-option {
  display: flex;
  align-items: center;
  padding: 8px 0;
  gap: 8px;
}

.dropdown-checkbox {
  flex-shrink: 0;
}

.dropdown-label {
  flex: 1;
  font-size: 13px;
  color: #111827;
}

.dropdown-option-divider {
  height: 8px;
}

.step-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.action-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #f3f4f6;
}

.action-btn.apply {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.action-btn.apply:hover {
  background: #1d4ed8;
}
