.region-selector {
  position: relative;
}

.region-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  cursor: pointer;
  font-size: var(--font-size-sm, 0.8125rem);
  color: var(--text-primary, #333);
  transition: all 0.2s ease;
  white-space: nowrap;

  &:hover, &.active {
    border-color: var(--accent-color, #497671);
    background: var(--bg-hover, rgba(73, 118, 113, 0.05));
  }

  .pin-icon {
    flex-shrink: 0;
    color: var(--accent-color, #497671);
  }

  .region-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;

    .detecting {
      animation: pulse 1s ease infinite;
    }
  }

  .chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;

    &.rotated {
      transform: rotate(180deg);
    }
  }
}

.region-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  overflow: hidden;
  animation: slideDown 0.15s ease;
}

.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-secondary, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detect-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--bg-hover, rgba(73, 118, 113, 0.08));
  color: var(--accent-color, #497671);
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    background: var(--accent-color, #497671);
    color: #fff;
  }
}

.region-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.region-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  cursor: pointer;
  font-size: var(--font-size-base, 0.875rem);
  color: var(--text-primary, #333);
  text-align: left;
  transition: background 0.15s ease;

  &:hover {
    background: var(--bg-hover, rgba(73, 118, 113, 0.06));
  }

  &.selected {
    background: var(--accent-color, #497671);
    color: #fff;

    .region-country {
      color: rgba(255, 255, 255, 0.7);
    }
  }

  .region-city {
    flex: 1;
  }

  .region-country {
    font-size: var(--font-size-xs, 0.75rem);
    color: var(--text-secondary, #999);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

// Mobile adjustments
@media (max-width: 768px) {
  .region-trigger {
    padding: 5px 8px;
    font-size: var(--font-size-xs, 0.75rem);

    .region-name {
      max-width: 80px;
    }
  }

  .region-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    min-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 60vh;

    .region-list {
      max-height: 50vh;
    }
  }
}
